public async Task <IHttpActionResult> Update(string testId, TestsEditViewModel model) { var test = await TestsDao.Read(this, testId); if (test == null) { return(NotFound()); } var result = await TestsDao.Update(this, test, model); return(JsonWithPermissions(result)); }
public async Task <ActionResult> Edit(Test test, TestsEditViewModel model) { if (test == null) { return(RedirectToAction("Index")); } if (!ModelState.IsValid) { return(View(model)); } try { await TestsDao.Update(this, test, model); } catch (Exception e) { ModelState.AddModelError("", e); return(View(model)); } return(RedirectToAction("Details", new { test = test.TestId })); }