public async Task <IActionResult> Add(InputCountryViewModel model) { if (!this.ModelState.IsValid) { return(this.View(model)); } var result = await this._countriesService.Add(model); this.TempData[GlobalConstants.SuccessMessageKey] = $"{model.Name}" + GlobalConstants.SuccessfullyAddedMessage; return(this.Redirect("Add")); }
public async Task <int> Add(InputCountryViewModel model) { var country = new Country { Name = model.Name, }; await this._countryRepository.AddAsync(country); var result = await this._countryRepository.SaveChangesAsync(); return(result); }