public PartialViewResult GetBatchDetail(int BatchID) { try { BatchDetailOutputModel batchDetail = batchBusiness.GetBatchDetail(BatchID); return(PartialView("_BatchDetail", batchDetail)); } catch { return(PartialView("_BatchDetail", new BatchDetailOutputModel())); } }
// Lấy thông tin chi tiết 1 lô hàng public BatchDetailOutputModel GetBatchDetail(int BatchID) { try { BatchDetailOutputModel batchDetail = new BatchDetailOutputModel(); var query = (from b in cnn.Batches join u in cnn.Users on b.CreateUserID equals u.UserID where b.IsActive.Equals(SystemParam.ACTIVE) && b.ID.Equals(BatchID) select new BatchDetailOutputModel { BatchID = b.ID, BatchCode = b.BatchCode, BatchName = b.BatchName, ListProduct = b.Products.Select(p => new ProductOfBatchModel { ProductID = p.ID, BatchID = p.BatchID, ProductCode = p.ProductCode, Status = p.Status }).ToList(), Point = b.Point, Note = b.Note, QTY = b.QTY, CreateUserName = u.UserName }).FirstOrDefault(); if (query != null && query.BatchID > 0) { return(batchDetail = query); } return(batchDetail); } catch { return(new BatchDetailOutputModel()); } }