Пример #1
0
        public async Task <ActionResult> Delete(string id, Chofer chofer)
        {
            try
            {
                var token = _session.GetString("Token");
                if (Seguridad.validarUsuarioAdministrativo(token))
                {
                    await _controladoraUsuarios.EliminarChofer(chofer, id);

                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(RedirectToAction("Login", "Account"));
                }
            }
            catch (MensajeException msg)
            {
                TempData["Error"] = msg.Message;
                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                TempData["Error"] = "Se produjo un error inesperado. Intente de nuevo mas tarde";
                return(RedirectToAction("Index"));
            }
        }