public ActionResult Create(ConfiguracionGlobalVM model) { try { if (!ModelState.IsValid) { return(View(model)); } var globalconfig = _mapper.Map <ConfiguracionGlobal>(model); var isSuccess = _globalConfigRepo.Create(globalconfig); if (!isSuccess) { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Delete(int id, ConfiguracionGlobalVM model) { try { var globalConfig = _globalConfigRepo.FindById(id); if (globalConfig == null) { return(NotFound()); } if (!_globalConfigRepo.Delete(globalConfig)) { return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } }
public ActionResult Edit(ConfiguracionGlobalVM model) { try { // TODO: Add update logic here if (!ModelState.IsValid) { return(View(model)); } var leaveType = _mapper.Map <ConfiguracionGlobal>(model); if (!_globalConfigRepo.Update(leaveType)) { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } return(RedirectToAction(nameof(Index))); } catch { ModelState.AddModelError("", "Something went wrong..."); return(View(model)); } }