public async Task <ActionResult> SamplePostComment(Lab lab, Sample sample, LabsSampleDetailsViewModel model) { if (sample == null) { return(HttpNotFound()); } var newModel = await LabsDao.GetSampleDetails(this, lab.LabId, sample.SampleId); newModel.Message = model.Message; if (!ModelState.IsValid) { return(View("SampleDetails", newModel)); } try { await LabsDao.PostComment(this, lab.LabId, sample.SampleId, model); } catch (Exception e) { ModelState.AddModelError("", e); return(View("SampleDetails", newModel)); } return(RedirectToAction("SampleDetails", new { lab = lab.LabId, sample = sample.SampleId })); }
public async Task <IHttpActionResult> Comment(long labId, long sampleId, LabsApiCommentModel model) { var result = await LabsDao.PostComment(this, labId, sampleId, model); if (result == null) { return(NotFound()); } return(JsonWithPermissions(result, true, false, false)); }