public void Remove(PermutaRemoveVM vm) { var model = GetCurrent(); if (model == null) { throw new InvalidOperationException("Permuta not found"); } model.DtExclusao = DateTime.Now; model.MotivoExclusao = vm.MotivoExclusao; SaveChanges(); }
public ActionResult Remove(PermutaRemoveVM vm) { if (!ModelState.IsValid) { ViewBag.RemoveError = true; ViewBag.MotivoExclusao = vm.MotivoExclusao; this.AlertError(); ViewBag.TipoOptions = _tipoUnidadeDomain.ToOptions(); ViewBag.RegiaoOptions = _regiaoUnidadeDomain.ToOptions(); return(View("Self", _domain.GetCurrent().ToEditVM())); } _domain.Remove(vm); this.AlertSuccess(); return(RedirectToAction("Index")); }