public async Task <IHttpActionResult> List(string query = null) { return(JsonWithPermissions(new { Results = await SamplesDao.Find(this, query) })); }
public async Task <ActionResult> ConfirmDelete(Sample sample) { if (sample != null) { await SamplesDao.Delete(this, sample); } return(RedirectToAction("Index")); }
public async Task <IHttpActionResult> Delete(int sampleId) { var result = await SamplesDao.Delete(this, sampleId); if (result == null) { return(NotFound()); } return(JsonWithPermissions(result)); }
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> Index(string query = null) { if (string.IsNullOrWhiteSpace(query)) { return(View(new SamplesSearchViewModel())); } var model = new SamplesSearchViewModel { Query = query, Results = await SamplesDao.Find(this, query) }; return(View(model)); }
public async Task <ActionResult> Create(SamplesCreateViewModel model) { if (!ModelState.IsValid) { return(View(model)); } Sample sample; try { sample = await SamplesDao.Create(this, model); } catch (Exception e) { ModelState.AddModelError("", e); return(View(model)); } return(RedirectToAction("Details", new { sample = sample.SampleId })); }
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 })); }
public async Task <IHttpActionResult> Create(SamplesCreateViewModel model) { return(JsonWithPermissions(await SamplesDao.Create(this, model))); }