public async Task <IActionResult> Create(CityRegistrationCreateViewModel model) { if (ModelState.IsValid) { var objcategory = new CityRegistration { id = model.id , stateid = model.stateid , cityName = model.cityName , isdeleted = false , isactive = false }; _unitofWork.city.Add(objcategory); bool res = _unitofWork.Save(); TempData["success"] = "Record Save successfully"; return(RedirectToAction(nameof(Index))); } else { ViewBag.Allcountry = _unitofWork.country.GetAll().Where(x => x.isdeleted == false).Select(x => new SelectListItem() { Text = x.countryname, Value = x.id.ToString() }); return(View(model)); } }
public async Task <IActionResult> Create(CityCreateViewModel model) { if (ModelState.IsValid) { var objcountry = new CityRegistration { id = model.id, stateid = model.stateid, cityName = model.cityName, isdeleted = false, isactive = false }; await _CityRegistrationservices.CreateAsync(objcountry); TempData["success"] = "Record Saved successfully"; return(RedirectToAction(nameof(Index))); } else { return(View()); } }
public async Task UpdateAsync(CityRegistration obj) { _context.CityRegistration.Update(obj); await _context.SaveChangesAsync(); }
public async Task CreateAsync(CityRegistration obj) { await _context.CityRegistration.AddAsync(obj); await _context.SaveChangesAsync(); }