コード例 #1
0
        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 }));
        }
コード例 #2
0
 public async Task <IHttpActionResult> Create(SamplesCreateViewModel model)
 {
     return(JsonWithPermissions(await SamplesDao.Create(this, model)));
 }