public ActionResult Create(EmprestimoVM emprestimoVM) { try { string validarId = "00000000-0000-0000-0000-000000000000"; if (emprestimoVM.Amigo.Id.ToString().Equals(validarId) || emprestimoVM.Jogo.Id.ToString().Equals(validarId)) { if (!ModelState.IsValid) { PreencherCombo(); return(View(emprestimoVM)); } } _business.Salvar(Mapper.Map <Emprestimo>(emprestimoVM)); return(RedirectToAction("Index")); } catch (Exception e) { PreencherCombo(); ModelState.AddModelError("", e.Message); return(View(emprestimoVM)); } }
public ActionResult Delete(Guid id, EmprestimoVM emprestimoVM) { try { _business.Deletar(Mapper.Map <Emprestimo>(emprestimoVM)); return(RedirectToAction("Index")); } catch (Exception e) { ModelState.AddModelError("", e.Message); return(View(emprestimoVM)); } }