Example #1
0
 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);
 }
Example #2
0
 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);
 }
Example #3
0
        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);
        }