/// <summary> /// This action shows the details of a project /// </summary> /// <param name="id">The id of the selected project</param> /// <returns>Event project details view</returns> // GET: EventProject/Details/5 public ActionResult ProjectDetailsPartial(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EventProject eventProject = db.EventProjects.Find(id); if (eventProject == null) { return(HttpNotFound()); } var model = new EventProjectViewModel { EventProjectId = eventProject.EventProjectId, Name = eventProject.Name, EventType = eventProject.EventType, Brief = eventProject.Brief, Street = eventProject.Street, District = eventProject.District, City = eventProject.City, Status = eventProject.Status, DateCreated = eventProject.DateCreated, Employee = eventProject.Employee.FullName, Client = eventProject.Client.FullName, ProjectSchedules = eventProject.ProjectSchedules.ToList(), UsherAppointeds = eventProject.UsherAppointeds.ToList(), }; return(PartialView(model)); }
public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } EventProject eventProject = db.EventProjects.Find(id); if (eventProject == null) { return(HttpNotFound()); } EventProjectViewModel model = new EventProjectViewModel { EventProjectId = eventProject.EventProjectId, Name = eventProject.Name, EventType = eventProject.EventType, Brief = eventProject.Brief, Street = eventProject.Street, District = eventProject.District, City = eventProject.City, Status = eventProject.Status, DateCreated = eventProject.DateCreated, Employee = eventProject.Employee.FullName, Client = eventProject.Client.FullName }; ViewBag.ClientServiceEmployeeId = new SelectList(db.Employees, "Id", "FullName"); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName"); return(View(model)); }
public ActionResult Create(EventProjectViewModel model) { if (ModelState.IsValid) { var eventProject = new EventProject { Name = model.Name, EventType = model.EventType, Brief = model.Brief, Street = model.Street, District = model.District, City = model.City, Status = model.Status, DateCreated = DateTime.Now, ClientServiceEmployeeId = User.Identity.GetUserId <int>(), ClientId = model.ClientId, }; db.EventProjects.Add(eventProject); db.SaveChanges(); ViewBag.ClientServiceEmployeeId = new SelectList(db.Employees, "Id", "FullName"); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName"); return(RedirectToAction("Index")); } else { ViewBag.ClientServiceEmployeeId = new SelectList(db.Employees, "Id", "FullName"); ViewBag.ClientId = new SelectList(db.Clients, "ClientId", "FullName"); return(View()); } }
public ActionResult DeleteConfirmed(int id) { EventProject eventProject = db.EventProjects.Find(id); db.EventProjects.Remove(eventProject); db.SaveChanges(); return(RedirectToAction("Index")); }