public ActionResult EditPartial(Int64 id) { bool has_error = false; ServiceActionViewModel model = null; try { var action = ActionService.GetActionById(id); if (action == null) { ModelState.AddModelError("", "Работа не найдена"); has_error = true; } model = ServiceActionModelConverter.ToModel(action); model.IsItInDialog = true; } catch (DomainException e) { ModelState.AddModelError("", e); has_error = true; } if (has_error) { return(RedirectToAction("Index", new { date = model.Date.ToString("dd.MM.yyyy"), user_id = model.ExpertId })); } PrepareForCreate(); return(PartialView("_Edit", model)); }
public ActionResult Delete(int id) { var action_srv = CompositionRoot.Resolve <IActionService>(); bool has_error = false; ServiceActionViewModel model = null; try { var action = action_srv.GetActionById(id); if (action == null) { ModelState.AddModelError("", "Работа не найдена"); has_error = true; } model = ServiceActionModelConverter.ToModel(action); } catch (DomainException e) { ModelState.AddModelError("", e); has_error = true; } if (has_error) { return(RedirectToAction("Index", new { date = model.Date.ToString("dd.MM.yyyy"), user_id = model.ExpertId })); } return(View(model)); }
public ActionResult GetById(Int64 id) { var action = ActionService.GetActionById(id); if (action == null) { return(Json(false, JsonRequestBehavior.AllowGet)); } return(Json(ServiceActionModelConverter.ToModel(action), JsonRequestBehavior.AllowGet)); }