Exemple #1
0
 public bool AddItem(PhuraseDetailModel detail)
 {
     try
     {
         var products = Mapper.Map <List <PhuraseProductEntity> >(detail.Products);
         ProteinDbContext.PhuraseDetails.Add(
             new PhuraseDetailEntity()
         {
             Account                 = detail.Account,
             DeliveryNumber          = detail.DeliveryNumber,
             OrderNumber             = detail.OrderNumber,
             Plat                    = (int)detail.Plat,
             Products                = products,
             TotalMoney              = detail.TotalMoney,
             TotalTax                = detail.TotalTax,
             TransferMoney           = detail.TransferMoney,
             TransferMoneyWithoutTax = detail.TransferMoneyWithoutTax,
             Remark                  = detail.Remark,
             ReceiptNumber           = detail.ReceiptNumber,
             IsWriteOffMoney         = detail.IsWriteOffMoney,
             Manager                 = detail.Manager,
             OrderCreateTime         = detail.OrderCreateTime,
             CompanyInvoiceNumber    = detail.CompanyInvoiceNumber,
             CompanyName             = detail.CompanyName
         }
             );
         ProteinDbContext.SaveChanges();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
     }
     return(true);
 }
 public bool AddItem(Item item)
 {
     try
     {
         var itemEntity = Mapper.Map <ItemEntity>(item);
         ProteinDbContext.Items.Add(itemEntity);
         ProteinDbContext.SaveChanges();
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
     }
     return(true);
 }