コード例 #1
0
        public bool savejoborderdetail(List <MODEL.JobOrderDetailModel> modellist, int joborderid)
        {
            try
            {
                using (_context = new HSSNInventoryEntities())
                {
                    foreach (var joborderdetail in modellist)
                    {
                        var model = new JobOrderDetail()
                        {
                            JobOrderId           = joborderid,
                            ProductionMaterialId = joborderdetail.ProductionMaterialId,
                            Quantity             = joborderdetail.Quantity,
                            PrnId = joborderdetail.PrnId,
                        };
                        _context.Entry(model).State = EntityState.Added;
                    }
                    _context.SaveChanges();
                    return(true);
                }
            }
            catch (Exception exception)
            {
                return(false);

                throw;
            }
        }
コード例 #2
0
 public bool savejoborderdetail(List<MODEL.JobOrderDetailModel> modellist, int joborderid)
 {
     try
     {
         using (_context = new HSSNInventoryEntities())
         {
             foreach (var joborderdetail in modellist)
             {
                 var model = new JobOrderDetail()
                 {
                     JobOrderId = joborderid,
                     ProductionMaterialId = joborderdetail.ProductionMaterialId,
                     Quantity = joborderdetail.Quantity,
                     PrnId = joborderdetail.PrnId,
                 };
                 _context.Entry(model).State = EntityState.Added;
             }
             _context.SaveChanges();
             return true;
         }
     }
     catch (Exception exception)
     {
         return false;
         throw;
     }
 }