public ActionResult SendOfferSave(Offer offer, string returnUrl = "HREmployeeIndex") { ViewBag.Path1 = "员工管理"; var clientList = db.User.Where(a => a.Id == WebSecurity.CurrentUserId).Single().HRClients.Select(a => a.Id).ToList(); Employee employee = db.Employee.Where(a => a.Id == offer.EmployeeId && clientList.Contains(a.ClientId)).SingleOrDefault(); if (employee == null) { return HttpNotFound(); } if (ModelState.IsValid) { try { employee.Timestamp = offer.Timestamp; employee.EmployeeStatus = EmployeeStatus.新增已通知; employee.OfferContent = offer.Content; Common.MailTo(employee.User.Mail, "Offer from E-Onboarding", offer.Content); db.PPSave(); return Redirect(Url.Content(returnUrl)); } catch (Exception e) { Common.RMOk(this, "记录" + employee + "发送Offer失败!" + e.ToString()); } } ViewBag.ReturnUrl = returnUrl; return View(offer); }
public ActionResult SendOffer(int id, string returnUrl = "HREmployeeIndex") { ViewBag.Path1 = "员工管理"; var clientList = db.User.Where(a => a.Id == WebSecurity.CurrentUserId).Single().HRClients.Select(a => a.Id).ToList(); Employee employee = db.Employee.Where(a => a.Id == id && clientList.Contains(a.ClientId)).SingleOrDefault(); if (employee == null) { return HttpNotFound(); } Offer offer = new Offer { EmployeeId = id, Content = "test" }; ViewBag.ReturnUrl = returnUrl; return View(offer); }