Exemplo n.º 1
0
        public async Task <IActionResult> DeleteConfirmed(int id)
        {
            try
            {
                await PatientsHelper.CancelPatientExAsync(id);

                await AppDataHelper.CheckReagentsStockAsync(_context);

                if (!Request.Cookies.ContainsKey("reagentAlert"))
                {
                    Response.Cookies.Append("reagentAlert", "true", new CookieOptions {
                        Expires = DateTime.Now.AddMinutes(10)
                    });
                }
                return(RedirectToAction(nameof(Index)));
            }
            catch (DbUpdateException)
            {
                return(RedirectToAction(nameof(Delete), new { id = id, saveChangesError = true }));
            }
        }