// GET: PaySlip public ActionResult Create() { isAdminLogged(); var currentUser = Session["admin"] as Account; Staff staff = _staffService.GetByAccount(currentUser.UserName); var model = new CreatePaySlipViewModel() { date = DateTime.Now, idDistributor = null, nameDistributor = null, moneyPay = null, reason = null, idPaySlip = _paySlipService.GeneratePaySlipId(), staffName = staff.staffName }; return(View(model)); }
public ActionResult Create(CreatePaySlipViewModel model) { isAdminLogged(); var currentUser = Session["admin"] as Account; var paySlip = new PaySlip { CreatedDate = DateTime.Now, idDistributor = model.idDistributor, idStaff = _staffService.GetByAccount(currentUser.UserName).idStaff, AmountSpent = model.moneyPay, SpendingReasons = model.reason }; var result = _paySlipService.CreatePaySlip(paySlip); if (result == "thanh cong") { TempData["success"] = "thanh cong"; } else { TempData["fail"] = result; } return(RedirectToAction("Create", new { PaySlipId = model.idPaySlip })); }