public async Task <IActionResult> Edit(CountryRegistrationCreateViewModel model) { if (ModelState.IsValid) { var storeobj = _unitofWork.country.Get(model.id); if (storeobj == null) { TempData["error"] = "Record Not Found"; return(NotFound()); } storeobj.id = model.id; storeobj.countryname = model.countryname; storeobj.countrycode = model.countrycode; _unitofWork.country.Update(storeobj); bool res = _unitofWork.Save(); TempData["success"] = "Record Update successfully"; return(RedirectToAction(nameof(Index))); } else { return(View()); } }
public async Task <IActionResult> Create(CountryRegistrationCreateViewModel model) { if (ModelState.IsValid) { var objcategory = new CountryRegistration { id = model.id , countrycode = model.countrycode , countryname = model.countryname , isdeleted = false , isactive = false }; _unitofWork.country.Add(objcategory); bool res = _unitofWork.Save(); TempData["success"] = "Record Save successfully"; return(RedirectToAction(nameof(Index))); } else { return(View()); } }
public IActionResult Edit(int id) { var objcategory = _unitofWork.country.Get(id); if (objcategory == null) { return(NotFound()); } var model = new CountryRegistrationCreateViewModel() { id = objcategory.id, countrycode = objcategory.countrycode, countryname = objcategory.countryname }; return(View(model)); }
public IActionResult Create() { var model = new CountryRegistrationCreateViewModel(); return(View(model)); }