public IActionResult ViewCurrentShift(int shiftId, string shift)
        {
            OperatorLogViewModel operatorLogViewModel = new OperatorLogViewModel();
            OperatorShiftLog     shiftLog;

            if (shift == "current")
            {
                shiftLog = _shiftLogRepository.GetOrCreateShiftLog(DateTime.Now);
            }
            else
            {
                shiftLog = _shiftLogRepository.GetShiftLogById(shiftId);
            }

            operatorLogViewModel.CurrentShift           = shiftLog;
            operatorLogViewModel.NeedOperators          = shiftLog.Operators == null || shiftLog.Operators == "";
            operatorLogViewModel.BatchReports           = GetBatchesForShift(shiftLog.OperatorShiftLogId);
            operatorLogViewModel.ToteChanges            = _shiftLogRepository.GetToteChanges(shiftLog.OperatorShiftLogId);
            operatorLogViewModel.TotalReworkToteChanges = _shiftLogRepository.GetTotalReworkCount(shiftLog.OperatorShiftLogId);


            ViewBag.Totes        = _materialDetailsRepository.GetListOfActiveMaterialsForDropDown();
            ViewBag.Recipes      = _batchRepository.GetRecipeNamesForDropDown();
            ViewBag.ShiftColours = _shiftLogRepository.GetShiftColoursForDropDown();

            return(View(operatorLogViewModel));
        }
 public IActionResult AddGoodStockToWaste(OperatorLogViewModel model)
 {
     _shiftLogRepository.AddGoodStockToWaste(model.GoodStockToWaste);
     return(Json(new { recipe = model.GoodStockToWaste.RecipeName, amount = model.GoodStockToWaste.Amount }));
     //return RedirectToAction("ViewCurrentShift", new { shiftId = model.CurrentShift.OperatorShiftLogId });
 }