public override int InsertCategory(Category category) { var context = new MoneyBoxEntities(); var obj = new tblMoneyBox_Categories(); category.CopyToObject(obj); context.AddTotblMoneyBox_Categories(obj); context.SaveChanges(); return obj.Id; }
public override void UpdateCategory(Category category) { var context = new MoneyBoxEntities(); var obj = new tblMoneyBox_Categories {Id = category.Id}; context.AttachTo("tblMoneyBox_Categories", obj); category.CopyToObject(obj); context.SaveChanges(); }