public async Task <ActionResult> AddNew(ServiceCategoryReceivingDTO serviceCategoryReceivingDTO) { var response = await _serviceCategoryService.AddServiceCategory(serviceCategoryReceivingDTO); if (response.StatusCode >= 400) { return(StatusCode(response.StatusCode, response)); } var serviceCategory = ((ApiOkResponse)response).Result; return(Ok(serviceCategory)); }
public IActionResult ServiceCategory([FromBody] MvServiceCategory serviceCategory) { try { int serviceCategoryId = serviceCategoryService.AddServiceCategory(serviceCategory); return(Ok(serviceCategoryId)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public async Task <IActionResult> AddServiceCategory([FromBody] ServiceCategoryViewModel request ) { if (!ModelState.IsValid) { return((IActionResult)BadRequest()); } var result = await _serviceCategoryService.AddServiceCategory(request); return(CreatedAtAction(nameof(AddServiceCategory), new { id = result.Id }, null)); }