Exemplo n.º 1
0
        public RedirectToRouteResult DecideQualityControl(int id, bool accepted, bool qcByDate = false)
        {
            var barcode = _repositoryFactory.BarcodeRepository.GetNullableById(id);

            if (barcode != null)
            {
                if (accepted)
                {
                    _barcodeService.AcceptQualityControl(_repositoryFactory, barcode);
                    Message = "Barcode data has been accepted and user will be notified.";
                }
                else
                {
                    _barcodeService.DeclineQualityControl(_repositoryFactory, barcode);
                    Message = "Barcode data has been declined and new barcode has been created";
                }
            }
            else
            {
                Message = "Barcode not found";
                return(RedirectToAction("Index", "UserJob"));
            }

            if (qcByDate)
            {
                return(RedirectToAction("ByDate", "QualityControl", new { date = barcode.DateTimeValidated.Value }));
            }
            else
            {
                return(RedirectToAction("QualityControl", new { id = id }));
            }
        }