public async Task <IActionResult> InsertDepartment(string values) { try { await _webApiService.InsertAsync <Department>(values); return(Ok()); } catch (Exception e) { return(BadRequest(e)); } }
public async Task <IActionResult> CreateSeller(Seller seller) { if (!ModelState.IsValid) { List <Department> departmentList = await _webApiService.FindAllAsync <Department>(); SellerFormViewModel viewModel = new SellerFormViewModel { Seller = seller, Departments = departmentList }; return(View(viewModel)); } string jsonValues = JsonConvert.SerializeObject(seller); await _webApiService.InsertAsync <Seller>(jsonValues); return(RedirectToAction(nameof(Index))); }