示例#1
0
        public async Task <ActionResult> Create(HelloWorldViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            await _service.CreateAsync(Mapper.Map <HelloWorldModel>(model));

            return(RedirectToAction(nameof(HelloWorldController.Index)));
        }
示例#2
0
        public async Task Post(HelloWorldViewModel model)
        {
            var mappedModel = Mapper.Map <HelloWorldModel>(model);

            await _helloWorldService.CreateAsync(mappedModel);
        }