public async Task <IActionResult> Add(AddServiceDto addServiceDto) { if (!ModelState.IsValid) { return(View()); } await _serviceService.AddServiceAsync(addServiceDto); return(RedirectToAction("list", "service")); }
public async Task <IActionResult> PostAsync(ServiceCreateModel value) { try { var result = await serviceService.AddServiceAsync(value); return(Ok(result)); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> AddService(ServiceViewModel newService) { if (!ModelState.IsValid) { return(RedirectToAction("Index")); } var successful = await _serviceService .AddServiceAsync(newService); if (!successful) { return(BadRequest("Could not add service.")); } return(RedirectToAction("Index")); }