public ViewResult Details(int id) { Squawk squawk = _dataService.GetSquawkById(id); SquawkDetailViewModel model = new SquawkDetailViewModel() { AircraftId = squawk.AircraftId, Description = squawk.Description, Id = squawk.Id, PostedBy = squawk.PostedBy.FullName, PostedOn = squawk.PostedOn, RegistrationNumber = squawk.Aircraft.RegistrationNumber, //RespondedBy = ResolvedOn = squawk.ResolvedOn, ResolutionNotes = squawk.ResolutionNotes, Status = squawk.Status, Subject = squawk.Subject }; foreach (var comment in squawk.Comments) { SquawkCommentViewModel commentVM = new SquawkCommentViewModel() { Id = comment.Id, PostedById = comment.PostedByMemberId, PostedOn = comment.PostDate, Text = comment.Text }; Member poster = _dataService.GetMember(comment.PostedByMemberId); commentVM.PostedBy = poster.FullName; model.Comments.Add(commentVM); } return View(ViewNames.SquawkDetails, model); }
public ActionResult DeleteComment(SquawkCommentViewModel viewModel) { _dataService.DeleteSquawkComment(viewModel.Id); return RedirectToAction("Details", new { id = viewModel.SquawkId }); }
public ActionResult AddComment(SquawkCommentViewModel viewModel) { SquawkComment comment = new SquawkComment() { PostDate = DateTime.Now, PostedByMemberId = ((AuthenticatedUser)Session[ContextVariables.AuthenticatedUser]).MemberId, SquawkId = viewModel.SquawkId, Text = viewModel.Text }; _dataService.AddSquawkComment(comment); return RedirectToAction("Details", new { id = viewModel.SquawkId }); }
public ActionResult DeleteComment(int commentId) { SquawkComment comment = _dataService.GetSquawkComment(commentId); SquawkCommentViewModel vm = new SquawkCommentViewModel() { Id = comment.Id, Text = comment.Text, SquawkId = comment.SquawkId }; return View("DeleteSquawkComment", vm); }
public ActionResult AddComment(int squawkId) { SquawkCommentViewModel viewModel = new SquawkCommentViewModel(); viewModel.SquawkId = squawkId; return View("AddSquawkComment", viewModel); }