// GET: Jobs public async Task <ActionResult> Details(string id) { if (id != null) { var province = await db.Provinces .Select(i => new SelectListItem() { Text = i.Name, Value = i.IdProvince, Selected = false }).ToArrayAsync(); ViewBag.Provinces = province; var transaction = await db.JobTransactions.Where(x => x.Volunteer.UserName == User.Identity.Name && x.Job.Id == id).OrderByDescending(x => x.Registered).FirstOrDefaultAsync(); if (transaction != null) { ViewBag.Status = transaction.Status.ToString(); } var details = await repository.GetDetails(id); if (details != null) { return(View(details)); } } return(View("Error")); }