Ejemplo n.º 1
0
 public InvoiceTypeVM EditInvoiceType(InvoiceTypeVM c)
 {
     DB.tblInvoiceType InvoiceType = IMSDB.tblInvoiceTypes.Find(c.InvoiceTypeId);
     if (InvoiceType != null)
     {
         InvoiceType.InvoiceType        = c.InvoiceType;
         InvoiceType.IsActive           = c.IsActive;
         IMSDB.Entry(InvoiceType).State = EntityState.Modified;
         IMSDB.SaveChanges();
     }
     return(c);
 }
Ejemplo n.º 2
0
 public InvoiceTypeVM AddInvoiceType(InvoiceTypeVM c)
 {
     DB.tblInvoiceType InvoiceType = IMSDB.tblInvoiceTypes.Add(
         new DB.tblInvoiceType
     {
         InvoiceType = c.InvoiceType,
         IsActive    = c.IsActive
     });
     IMSDB.SaveChanges();
     c.InvoiceTypeId = InvoiceType.InvoiceTypeId;
     return(c);
 }
Ejemplo n.º 3
0
        public InvoiceTypeVM GetInvoiceTypeById(int InvoiceTypeId)
        {
            DB.tblInvoiceType InvoiceType = IMSDB.tblInvoiceTypes.Where(p => p.InvoiceTypeId == InvoiceTypeId).FirstOrDefault();
            if (InvoiceType != null)
            {
                return(new InvoiceTypeVM()
                {
                    InvoiceTypeId = InvoiceType.InvoiceTypeId,
                    InvoiceType = InvoiceType.InvoiceType,
                    IsActive = InvoiceType.IsActive
                });
            }

            return(null);
        }