public JsonResult GetProdLinePerformanceProd(int prodLineId)
        {
            ProductionLinesModel productionLine = GetProductionLine(prodLineId);
            List <ProdLinesPerformanceTargetProductModel> prodLineProducts = new List <ProdLinesPerformanceTargetProductModel>();

            using (ProdLinesPerformProdService service = new ProdLinesPerformProdService())
            {
                var dtos = service.GetByProdLineId(prodLineId);
                prodLineProducts.AddRange(Mapper.Map <List <ProdLinesPerformProdDto>, List <ProdLinesPerformanceTargetProductModel> >(dtos));
            }
            using (TPOProductService productService = new TPOProductService())
            {
                var dtos = productService.GetAllByProdLineId(prodLineId);
                foreach (var dto in dtos)
                {
                    if (prodLineProducts.FirstOrDefault(p => p.ProductID == dto.ID) != null)
                    {
                        continue;
                    }
                    prodLineProducts.Add(
                        new ProdLinesPerformanceTargetProductModel()
                    {
                        LocID       = productionLine.PlantId,
                        ProdLineID  = prodLineId,
                        ProductID   = dto.ID,
                        ProductName = dto.ProductCode,
                        Throughput  = 0,
                    }
                        );
                }
            }
            return(Json(prodLineProducts, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AjaxProductUpdate(string row)
        {
            ProdLinesPerformanceTargetProductModel model = JsonConvert.DeserializeObject <ProdLinesPerformanceTargetProductModel>(row);

            if (model != null)
            {
                model.DateChange = DateTime.Now;
                ProdLinesPerformProdDto dto = new ProdLinesPerformProdDto();
                using (ProdLinesPerformProdService service = new ProdLinesPerformProdService())
                {
                    Mapper.Map(model, dto);
                    if (model.Id > 0)
                    {
                        service.Update(dto);
                    }
                    else
                    {
                        service.Add(dto);
                    }
                }
                return(RedirectToAction("Index", new { lineId = model.ProdLineID }));
            }
            return(RedirectToAction("Index"));
        }