public AccountingMethodVM EditAccountingMethod(AccountingMethodVM c) { DB.tblAccountingMethod AccountingMethod = IMSDB.tblAccountingMethods.Find(c.AccountingMethodId); if (AccountingMethod != null) { AccountingMethod.AccountingMethod = c.AccountingMethod; AccountingMethod.IsActive = c.IsActive; IMSDB.Entry(AccountingMethod).State = EntityState.Modified; IMSDB.SaveChanges(); } return(c); }
public AccountingMethodVM AddAccountingMethod(AccountingMethodVM c) { DB.tblAccountingMethod AccountingMethod = IMSDB.tblAccountingMethods.Add( new DB.tblAccountingMethod { AccountingMethod = c.AccountingMethod, IsActive = c.IsActive }); IMSDB.SaveChanges(); c.AccountingMethodId = AccountingMethod.AccountingMethodId; return(c); }
public AccountingMethodVM GetAccountingMethodById(int AccountingMethodId) { DB.tblAccountingMethod AccountingMethod = IMSDB.tblAccountingMethods.Where(p => p.AccountingMethodId == AccountingMethodId).FirstOrDefault(); if (AccountingMethod != null) { return(new AccountingMethodVM() { AccountingMethodId = AccountingMethod.AccountingMethodId, AccountingMethod = AccountingMethod.AccountingMethod, IsActive = AccountingMethod.IsActive }); } return(null); }