public async Task <IActionResult> OnPostCreateOpinionAsync([Bind] CreateOpinionDto createOpinionModel) { string offerId = createOpinionModel.OfferId; if (!ModelState.IsValid) { return(await this.OnGetAsync(offerId)); } var opinionCreated = await opinionService.CreateOpinion(createOpinionModel.Text, offerId); if (opinionCreated == null) { return(await this.OnGetAsync(offerId)); } var offerRateAdded = await ratingManager.AddOfferRate(createOpinionModel.Rating, opinionCreated.Id, opinionCreated.UserId); if (!offerRateAdded) { await opinionService.DeleteOpinion(opinionCreated.Id, opinionCreated.UserId); Alertify.Push("Creating opinion failed", AlertType.Error); return(await this.OnGetAsync(offerId)); } return(RedirectToPage("/OfferDetails", new { area = "Offers", id = offerId })); }