public CustomerTypeVM EditCustomerType(CustomerTypeVM c) { DB.tblCustomerType CustomerType = IMSDB.tblCustomerTypes.Find(c.CustomerTypeId); if (CustomerType != null) { CustomerType.CustomerType = c.CustomerType; CustomerType.IsActive = c.IsActive; IMSDB.Entry(CustomerType).State = EntityState.Modified; IMSDB.SaveChanges(); } return(c); }
public CustomerTypeVM AddCustomerType(CustomerTypeVM c) { DB.tblCustomerType CustomerType = IMSDB.tblCustomerTypes.Add( new DB.tblCustomerType { CustomerType = c.CustomerType, IsActive = c.IsActive }); IMSDB.SaveChanges(); c.CustomerTypeId = CustomerType.CustomerTypeId; return(c); }
public CustomerTypeVM GetCustomerTypeById(int CustomerTypeId) { DB.tblCustomerType CustomerType = IMSDB.tblCustomerTypes.Where(p => p.CustomerTypeId == CustomerTypeId).FirstOrDefault(); if (CustomerType != null) { return(new CustomerTypeVM() { CustomerTypeId = CustomerType.CustomerTypeId, CustomerType = CustomerType.CustomerType, IsActive = CustomerType.IsActive }); } return(null); }