Example #1
0
        public async Task <ActionResult> Create(AutoCreateViewModel auto)
        {
            if (ModelState.IsValid)
            {
                var operation = await _autoService.CreateAutoAsync(auto.ToDto());

                if (operation.Success)
                {
                    Session["Create"] = new AlertViewModel(operation.Message, AlertType.Success);

                    return(RedirectToAction("Index", "Home"));
                }

                return(new HttpOperationStatusResult(operation));
            }

            return(View(auto));
        }
Example #2
0
 public static AutoDto ToDto(this AutoCreateViewModel model)
 {
     return(MapperWEB.Map <AutoCreateViewModel, AutoDto>(model));
 }