Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        public async Task <IActionResult> Add([FromBody] ServiceModel data)
        {
            var dataEntity = await _servicesService.Add(ServiceMapper.Map(data));

            return(Ok(dataEntity));
        }