Пример #1
0
        public async Task <ActionResult> Create(ReagentsCreateViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            Reagent newReagent = null;

            try
            {
                newReagent = await ReagentsDao.Create(this, model);
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.ToString());
                return(View(model));
            }

            return(RedirectToAction("Details", new { reagent = newReagent?.ReagentId ?? 0 }));
        }
Пример #2
0
 public async Task <IHttpActionResult> Create(ReagentsCreateViewModel model)
 {
     return(JsonWithPermissions(await ReagentsDao.Create(this, model)));
 }