public void Delete(Guid id) { var context = new HomeworkDBEntities(); var item = context.AccountBook.Where(obj => id == obj.Id).FirstOrDefault(); if (item != null) { context.AccountBook.Remove(item); context.SaveChanges(); } }
public void Create(HomeworkViewModel model) { var context = new HomeworkDBEntities(); var item = new ORM.AccountBook(); item.Id = Guid.NewGuid(); item.Amounttt = (int)model.Amount; item.Categoryyy = model.Type; item.Remarkkk = model.Name; item.Dateee = model.CreateDate; context.AccountBook.Add(item); context.SaveChanges(); }
public void Update(HomeworkViewModel model) { var context = new HomeworkDBEntities(); var item = context.AccountBook.Where(obj => model.ID == obj.Id).FirstOrDefault(); if (item != null) { item.Amounttt = (int)model.Amount; item.Categoryyy = model.Type; item.Remarkkk = model.Name; item.Dateee = model.CreateDate; context.SaveChanges(); } }