public async Task <IActionResult> Update(HangPhong model) { var data = await _HangPhongManager.Find_By_Id(model.Id); if (data != null) { await _HangPhongManager.Update(model); ViewData["successMsg"] = "Sửa thành công"; } return(Redirect("/hang-phong/danh-sach-hang-phong")); }
public async Task Update(HangPhong inputModel) { try { await _unitOfWork.HangPhongRepository.Update(inputModel); await _unitOfWork.SaveChange(); } catch (Exception ex) { await _unitOfWork.Rollback(); throw ex; } }
public async Task <HangPhong> Create(HangPhong inputModel) { try { var result = await _unitOfWork.HangPhongRepository.Add(inputModel); await _unitOfWork.SaveChange(); return(result); } catch (Exception ex) { throw ex; } }
public async Task <IActionResult> Delete(HangPhong model) { try { var item = await _HangPhongManager.Find_By_Id(model.Id); item.TrangThai = false; await _HangPhongManager.Update(item); return(Json(new { data = true })); } catch (Exception ex) { return(Json(new { data = false })); } }
public async Task <IActionResult> Create(HangPhong inputModel) { await _HangPhongManager.Create(inputModel); return(View()); }