public async Task <ActionResult> Details(Guid id) { var model = new AuctionDetailViewModel { Auction = await AuctionProcessFacade.GetAuctionAsync(id), NewBid = new BidDto(), Bids = (await AuctionProcessFacade.GetBidsToAuctionAsync(id)).OrderBy(bid => bid.Time).ToList(), Comments = (await UserInteractionFacade.GetCommentsAccordingToAuction(id)).OrderBy(com => com.Time).ToList(), NewComment = new CommentDto() }; model.NewBid.BidAmount = model.Auction.MinimalBid; return(View("AuctionDetailView", model)); }
public async Task <ActionResult> Comment(AuctionDetailViewModel model) { try { model.NewComment.AuctionId = model.Auction.Id; model.NewComment.Username = User.Identity.Name; model.NewComment.UserId = (await UserFacade.GetUserAccordingToUsernameAsync(User.Identity.Name)).Id; model.NewComment.Time = DateTime.Now; await UserInteractionFacade.CreateComment(model.NewComment); return(RedirectToAction("Details", new { id = model.Auction.Id })); } catch { return(RedirectToAction("Details", new { id = model.Auction.Id })); } }
public async Task <ActionResult> DeleteComment(Guid commentId, Guid auctionId) { await UserInteractionFacade.DeleteComment(commentId); return(RedirectToAction("Details", new { id = auctionId })); }