Пример #1
0
        public async Task <IActionResult> Create([FromForm] SampleViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var dto = mapper.Map <SampleModel>(model);

            await sampleService.CreateAsync(dto);

            return(RedirectToAction("Index"));
        }
Пример #2
0
        public async Task <IActionResult> Upload([FromBody] GoblinApi_BaseCreateSampleModel model, CancellationToken cancellationToken = default)
        {
            var sampleModel = await _sampleService.CreateAsync(model, cancellationToken);

            return(Created(Url.Action("Get", new { sampleModel.Id }), sampleModel));
        }