public async Task <ActionResult> EditSummary(int?summaryId) { try { if (summaryId == null) { return(RedirectToAction("Index", new { message = ManageMessageId.Error })); } var userId = User.Identity.GetUserId(); var editedSummary = await _summariesLogic.GetUserOrder(summaryId, userId); var userCars = await _carLogic.GetAllUserCars(userId); SelectList carsSelectList = new SelectList(userCars, "CarId", "FullName"); var editView = await _summariesLogic.GetEditSummaryView(editedSummary); ViewBag.UserCars = carsSelectList; ViewBag.EditSummary = editView; return(View("EditSummaryView", editedSummary)); } catch (ArgumentNullException) { return(RedirectToAction("Index", new { message = ManageMessageId.Error })); } catch (NullReferenceException) { return(RedirectToAction("Index", new { message = ManageMessageId.Error })); } catch (InvalidOperationException) { return(RedirectToAction("Index", new { message = ManageMessageId.AccessDeny })); } }
public async Task <ActionResult> EditSummary(int?summaryId) { try { if (summaryId == null) { return(RedirectToAction("Index", new { message = AdminMenuMessages.Error })); } var editedSummary = await _summariesLogic.FindSummaryById(summaryId); var userCars = await _carLogic.GetAllUserCars(editedSummary.User.Id); SelectList carsSelectList = new SelectList(userCars, "CarId", "FullName"); var editView = await _summariesLogic.GetEditSummaryView(editedSummary); ViewBag.UserCars = carsSelectList; ViewBag.EditSummary = editView; return(View("EditSummaryView", editedSummary)); } catch (ArgumentNullException) { return(RedirectToAction("Index", new { message = AdminMenuMessages.Error })); } catch (NullReferenceException) { return(RedirectToAction("Index", new { message = AdminMenuMessages.Error })); } }