private void GetRequisitionComplete() { var allRequisitions = _requisitionManager.GetAll(); foreach (var request in allRequisitions) { var today = DateTime.Now; if (request.JouneyEnd < today) { request.Status = "Complete"; _requisitionManager.Update(request); } } }
}//details public ActionResult View(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } var employee = _employeeManager.GetAll(); var requsition = _requsitionManager.GetById((int)id); RequsitionViewModel requsitionVM = new RequsitionViewModel() { Id = requsition.Id, Form = requsition.Form, To = requsition.To, Description = requsition.Description, JourneyStart = requsition.JourneyStart, JouneyEnd = requsition.JouneyEnd, Employee = employee.Where(x => x.Id == requsition.EmployeeId).FirstOrDefault() }; requsition.Status = "Seen"; _requsitionManager.Update(requsition); return(View(requsitionVM)); }
public ActionResult Edit(RequsitionViewModel requsitionVM) { try { Requsition requsition = new Requsition(); requsition.Id = requsitionVM.Id; requsition.Form = requsitionVM.Form; requsition.To = requsitionVM.To; requsition.Description = requsitionVM.Description; requsition.JourneyStart = requsitionVM.JourneyStart; requsition.JouneyEnd = requsitionVM.JouneyEnd; requsition.EmployeeId = requsitionVM.EmployeeId; requsition.RequsitionStatusId = requsitionVM.RequsitionStatusId; _requsitionManager.Update(requsition); return(RedirectToAction("Index")); } catch { return(View()); } }