public ActionResult Edit(Vacance v1, int id) { try { Domain.Entity.Vacance vacance = vs.GetById(id); vacance.Date_Debut = v1.Date_Debut; vacance.Date_Fin = v1.Date_Fin; vacance.typeholiday = v1.typeholiday; //vacance.VacanceId = v1.VacanceId; vs.Update(vacance); vs.Commit(); } catch (DataException /* dex */) { //Log the error (uncomment dex variable name and add a line here to write a log. return(RedirectToAction("Edit", new { id = id, saveChangesError = true })); } return(RedirectToAction("index")); }
// GET: Vacance/Create public ActionResult Create() { Vacance vacanceModel = new Vacance(); /// List <string> Vacances = new List <string> { "DayOff", " OfficialVacation" }; ViewData["vacance"] = new SelectList(Vacances); var x = rs.GetAll(). Select(w => new SelectListItem { Text = w.Nom, Value = w.idRessource.ToString() }); vacanceModel.Ressourcess = x; return(View(vacanceModel)); }
public ActionResult Create(Vacance vacanceVM) { try { Domain.Entity.Vacance v = new Domain.Entity.Vacance(); v.Date_Debut = vacanceVM.Date_Debut; v.Date_Fin = vacanceVM.Date_Fin; v.typeholiday = vacanceVM.typeholiday; v.idRessource = vacanceVM.idRessource; vs.Add(v); vs.Commit(); return(RedirectToAction("Index")); } catch { return(View()); } }