//Create public Category Insert(Category category) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { ctx.Category.Add(category); ctx.SaveChanges(); return this; } }
//Update public Category Update(Category category) { using (OrderTrackEntities ctx = new OrderTrackEntities()) { Category Category = ctx.Category.First(x => x.CategoryID == this.CategoryID); Category = category; ctx.SaveChanges(); return Category; } }
public Category Put(Category category) { return new Category().Insert(category); }
public Category Post(Category category) { return new Category().Update(category); }