Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - using System.Collections.Generic;
 - using System.Linq;
 - namespace Yes.Models
 - {
 - public partial class MobileCarrier
 - {
 - YesDataContext dc = new YesDataContext();
 - public MobileCarrier GetMobileCarrier(int id)
 - {
 - return (from mc in this.dc.MobileCarriers where mc.ID == id select mc).SingleOrDefault();
 - }
 - public IEnumerable<MobileCarrier> GetAll()
 - {
 - return from mc in this.dc.MobileCarriers orderby mc.Name select mc;
 - }
 - public void Insert()
 - {
 - this.dc.MobileCarriers.InsertOnSubmit(this);
 - this.dc.SubmitChanges();
 - }
 - public void Update()
 - {
 - this.dc.MobileCarriers.Attach(this);
 - this.dc.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, this);
 - this.dc.SubmitChanges();
 - }
 - public void Delete()
 - {
 - this.dc.MobileCarriers.Attach(this);
 - this.dc.Refresh(System.Data.Linq.RefreshMode.KeepCurrentValues, this);
 - this.dc.MobileCarriers.DeleteOnSubmit(this);
 - this.dc.SubmitChanges();
 - }
 - }
 - }
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment