public ActionResult Add(Account model) { try { model.Time = _dateTime; if (ModelState.IsValid) { _repository.Add(model); Alerts.Type = 6; return(RedirectToAction("Index", "AccountClient")); } else { Alerts.Type = 7; ViewBag.response = Alerts.Type; return(View()); } } catch (Exception) { Alerts.Type = 7; ViewBag.response = Alerts.Type; return(View()); throw; } }
public ActionResult Add(Account model) { model.CreatedAt = DateTime.Now; if (ModelState.IsValid) { if (!_repository.VerifyRequestAndClient(model.RequestId, model.ClientId)) { if (_repository.Add(model)) { TempData["response"] = "Cuenta creada con exito"; TempData["icon"] = "success"; } else { TempData["response"] = "Lo sentimos, no se ha creado la cuenta"; TempData["icon"] = "error"; } } else { TempData["response"] = "Este cliente tiene una cuenta con esta solicitud, porfavor solicite una nueva cuenta"; TempData["icon"] = "error"; } } else { TempData["response"] = "Lo sentimos, no se ha creado la cuenta"; TempData["icon"] = "error"; } return(RedirectToAction("Index", "AccountClient")); }