public PartialViewResult ProjectDetailPdf(int id) { ProjectDetailModel model = new ProjectDetailModel(); using (DeneysanContext db = new DeneysanContext()) { Projects project = db.Projects.Where(x => x.ProjeId == id).FirstOrDefault(); if (project != null) { model.Project = project; List<ProjectsGallery> gallery = db.ProjectsGallery.Where(x => x.ProjeId == id).ToList(); if (gallery != null && gallery.Count() > 0) model.ProjectImages = gallery; } return PartialView("ProjectDetail", model); } }
public ActionResult EditProject(int id) { ProjectDetailModel model = new ProjectDetailModel(); using (DeneysanContext db = new DeneysanContext()) { if (RouteData.Values["id"] != null) { int nid = 0; bool isnumber = int.TryParse(RouteData.Values["id"].ToString(), out nid); if (isnumber) { Projects record = db.Projects.Where(x => x.ProjeId == id).FirstOrDefault(); model.Project = record; model.ProjectImages = db.ProjectsGallery.Where(x => x.ProjeId == id).ToList(); var languages = LanguageManager.GetLanguages(); var list = new SelectList(languages, "Culture", "Language", record.Language); ViewBag.LanguageList = list; return View(model); } else return View(); } else return View(); } }