public ActionResult Index(int lineId = -1)
        {
            ProdLinePerformanceTargetModel model = new ProdLinePerformanceTargetModel()
            {
                CanShow = false
            };

            if (lineId >= 0)
            {
                model.ProdLineID = lineId;
                model.TPTUse     = "L";

                using (ProdLinesPerformService service = new ProdLinesPerformService())
                {
                    var dto = service.GetByLineId(lineId);
                    if (dto != null)
                    {
                        model = Mapper.Map <ProdLinesPerformDto, ProdLinePerformanceTargetModel>(dto);
                    }
                }
                ProductionLinesModel productionLine = GetProductionLine(lineId);
                ProdLineTypeModel    prodLineType   = GetProductionLineType(productionLine.LineTypeID);
                model.ProdLineDescCode = prodLineType.ProdLineTypeCode;
                model.CanShow          = true;
            }
            return(View(model));
        }
        public ActionResult Index(int lineId, ProdLinePerformanceTargetModel model)
        {
            using (ProdLinesPerformService service = new ProdLinesPerformService())
            {
                ProdLinesPerformDto dto;
                model.DateChange = DateTime.Now;
                ProductionLinesModel productionLine = GetProductionLine(lineId);

                model.LocID = productionLine.PlantId;
                if (string.IsNullOrEmpty(model.LineCode))
                {
                    model.LineCode = lineId.ToString();
                }

                if (string.IsNullOrEmpty(model.TPTUse))
                {
                    model.TPTUse = "L";
                }

                model.ModifiedBy   = CurrentUser;
                model.LastModified = DateTime.Now;

                if (model.Id > 0)
                {
                    dto               = service.Get(model.Id);
                    model.EnteredBy   = dto.EnteredBy;
                    model.DateEntered = dto.DateEntered;

                    Mapper.Map(model, dto);
                    service.Update(dto);
                }
                else
                {
                    model.EnteredBy   = CurrentUser;
                    model.DateEntered = DateTime.Now;

                    dto = new ProdLinesPerformDto();
                    Mapper.Map(model, dto);
                    service.Add(dto);
                }

                SetResponseMesssage(ActionTypeMessage.SuccessfulSave);
            }
            return(RedirectToAction("Index", new { lineId = lineId }));
        }