public ActionResult Create(Vacacion vacacion) { HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName]; FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(authCookie.Value); string name = ticket.Name; vacacion.fkAutorizacion = Convert.ToInt32(name); VacacionBLL.InsertObjetoVacacion(vacacion); return(RedirectToAction("Index", "Vacaciones")); }
public ActionResult Index(string sortOrder, string currentFilter, string searchString, int?page) { IEnumerable <Vacacion> listaDepartamento = VacacionBLL.SelectAll(); ViewBag.CurrentSort = sortOrder; ViewBag.NameSortParm = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; ViewBag.DateSortParm = sortOrder == "Date" ? "date_desc" : "Date"; if (searchString != null) { page = 1; } else { searchString = currentFilter; } ViewBag.CurrentFilter = searchString; var students = from s in listaDepartamento select s; if (!String.IsNullOrEmpty(searchString)) { students = students.Where(s => s.fkEmpleado.ToString().ToUpper().Contains(searchString.ToUpper()) || s.dateFechaInicio.ToString().ToUpper().Contains(searchString.ToUpper())); } switch (sortOrder) { case "name_desc": students = students.OrderByDescending(s => s.fkEmpleado); break; case "Date": students = students.OrderBy(s => s.dateFechaInicio); break; case "date_desc": students = students.OrderByDescending(s => s.dateFechaInicio); break; default: // Name ascending students = students.OrderBy(s => s.fkEmpleado); break; } return(View(students.ToList <Vacacion>())); }
public ViewResult Details(int id) { Vacacion departamento = VacacionBLL.GetVacacionById(id); return(View(departamento)); }