public async Task <IHttpActionResult> Update(int sampleId, SamplesEditViewModel model) { var sample = await SamplesDao.Read(this, sampleId); if (sample == null) { return(NotFound()); } var result = await SamplesDao.Update(this, sample, model); return(JsonWithPermissions(result)); }
public async Task <ActionResult> Edit(Sample sample, SamplesEditViewModel model) { if (sample == null) { return(HttpNotFound()); } if (!ModelState.IsValid) { return(View(model)); } try { await SamplesDao.Update(this, sample, model); } catch (Exception e) { ModelState.AddModelError("", e); return(View(model)); } return(RedirectToAction("Details", new { sample = sample.SampleId })); }