/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public Stat Add(Stat obj) { Stat stat = null; using (Entities model = new Entities()) { stat = model.Stats.Add(obj); model.SaveChanges(); } return stat; }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public Url Add(Url obj) { Url addedUrl = null; using (Entities model = new Entities()) { addedUrl = model.Urls.Add(obj); model.SaveChanges(); } return addedUrl; }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public Url Delete(Url obj) { Url deletedUrl = null; using (Entities model = new Entities()) { model.Urls.Attach(obj); model.Entry(obj).State = System.Data.Entity.EntityState.Deleted; model.SaveChanges(); } return deletedUrl; }
/// <summary> /// /// </summary> /// <param name="obj"></param> /// <returns></returns> public Url Update(Url obj) { Url url = null; using (Entities model = new Entities()) { url = model.Urls.Attach(obj); model.Entry(obj).State = System.Data.Entity.EntityState.Modified; model.SaveChanges(); } return url; }