public ActionResult Create(PhieuXuat model, FormCollection collection) { try { // TODO: Add insert logic here if (ModelState.IsValid) { var result = PhieuXuatManager.add(model); if (result != 0) { _phieu = null; putSuccessMessage("Thêm thành công"); return(RedirectToAction("Details", new { id = result })); } else { putErrorMessage("Thêm không thành công"); } } else { putModelStateFailErrors(ModelState); } //ViewBag.cultureInfo = CultureInfo; //ViewBag.DMSach = new SelectList(SachManager.getAllAlive() // .Where(s => s.Soluong > 0).ToList(), // nameof(SachManager.Properties.MaSoSach), // nameof(SachManager.Properties.TenSach), ""); //ViewBag.DMDaiLy = new SelectList(DaiLyManager.getAllAlive(), // nameof(DaiLyManager.Properties.MaSoDaiLy), // nameof(DaiLyManager.Properties.TenDaiLy), ""); //_phieu.NgayLap = DateTime.Now; //return View(_phieu); return(RedirectToAction("Create")); } catch (Exception ex) { putErrorMessage(ex.Message); return(View()); } }
public ActionResult CheckOut(PhieuXuat model) { if (isUserSessionExisted()) { currentPhieu.Daily = currentNguoiDung.DaiLy; currentPhieu.NgayLap = DateTime.Now; currentPhieu.NguoiNhan = currentNguoiDung.TenDayDu; currentPhieu.MaSoDaiLy = currentNguoiDung.DaiLy.MaSoDaiLy; var result = PhieuXuatManager.add(currentPhieu); if (result != 0) { return(RedirectToAction("OrderDetail", "Manager", new { id = result })); } else { return(RedirectToAction("CheckOut")); } } else { return(RedirectToAction("Login", "Account", null)); } }