Beispiel #1
0
        public async Task <IActionResult> ConfirmReceived(int id)
        {
            try
            {
                ReagentHelper.Init(_context);
                await ReagentHelper.UpdateReagentStockAsync(id);

                await AppDataHelper.CheckReagentsStockAsync(_context);

                if (!Request.Cookies.ContainsKey("reagentAlert"))
                {
                    Response.Cookies.Append("reagentAlert", "true", new CookieOptions {
                        Expires = DateTime.Now.AddMinutes(10)
                    });
                }
            }
            catch (Exception ex) when(ex is DbUpdateException || ex is DbUpdateConcurrencyException)
            {
                ModelState.AddModelError("", "Unable to save changes. " +
                                         "Try again, and if the problem persists, " +
                                         "see your system administrator.");
            }
            return(RedirectToAction(nameof(Index)));
        }
Beispiel #2
0
 public ReagentsController(MLabContext context)
 {
     _context = context;
     ReagentHelper.Init(_context);
 }