public async Task <IActionResult> Edit(countryIndexViewModel 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.Name = model.Name; storeobj.countrycode = model.countrycode; _unitofWork.country.Update(storeobj); _unitofWork.Save(); TempData["success"] = "Record Update successfully"; return(RedirectToAction(nameof(Index))); } else { return(View()); } }
public async Task <IActionResult> Create(countryIndexViewModel model) { if (ModelState.IsValid) { var objcategory = new country { id = model.id , Name = model.Name , countrycode = model.countrycode , isdeleted = false , isactive = false }; _unitofWork.country.Add(objcategory); _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 countryIndexViewModel() { id = objcategory.id, Name = objcategory.Name, countrycode = objcategory.countrycode, isactive = objcategory.isactive, isdeleted = objcategory.isdeleted }; return(View(model)); }
public IActionResult Create() { var model = new countryIndexViewModel(); return(View(model)); }