public ViewResult Departure(DepartureNewRequestModel model, FormCollection formCollection) { try { Request request = model; if (ModelState.IsValid) { //TO DO : Email guestResponse to ther part organizer if (request != null) { if(string.IsNullOrWhiteSpace(request.EmployeeNumber)) request.EmployeeNumber = "NA"; } SaveToDb(request); return View("Confirmation", request); } else { //there is a validation error - redisplay the form return View(model); } } catch (DbEntityValidationException ex) { AddModelError(ex); return View(model); } }
public ActionResult Departure() { ViewBag.Message = "Nouvelle demande"; var model = new DepartureNewRequestModel { kind = RequestKindEnum.Departure, DepartureDate=DateTime.Now.AddMonths(1) }; return View(model); }