public async Task <IActionResult> Create(CreateCompanyViewModel createCompanyViewModel) { if (ModelState.IsValid) { await _companiesService.Add(createCompanyViewModel); return(RedirectToAction(nameof(Index))); } return(View(createCompanyViewModel)); }
public async Task <IActionResult> Add([FromBody] CompanyModel model) { var newModel = await _service.Add(model); return(CreatedAtRoute("GetCompanyById", new { id = newModel.Id }, newModel)); }