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