public IActionResult Add(AddServiceViewModel vm) { if (!ModelState.IsValid) { return(View(vm)); } serviceService.Add(new Service { Title = vm.Title, Description = vm.Description, Icon = GetStringFromFile(vm.Icon) }); return(RedirectToIndex()); }
public async Task <IActionResult> Add([FromBody] ServiceModel data) { var dataEntity = await _servicesService.Add(ServiceMapper.Map(data)); return(Ok(dataEntity)); }