Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mikkel 143 posts 365 karma points
    Nov 16, 2017 @ 10:27
    mikkel
    0

    I need help with a page for reviews

    if I want to make a page where users can come up with reviews how do I get it. I think doctypes etc.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Nov 16, 2017 @ 10:38
    Michaël Vanbrabandt
    0

    Hi mikkel,

    you should give us some more details about you want to achieve.

    Whats needs to be done with the review after they filled in the form?

    Maybe you can have a look at Umbraco Forms where you can setup workflows like sending the review as an email to a person or save it in a database.

    You could also do it yourself if you just want to send the review as an email to a person.

    1. Create a SurfaceController called ReviewController where you call the partial view which contains the form for the front end
    2. Add a new action to your controller which performs the sending task called Send. Here you can pass a new viewmodel called ReviewViewModel which contains the form data
    3. Send the email from within your reviewcontroller

    Hope this helps!

    Kind regards,

    /Michaël

  • mikkel 143 posts 365 karma points
    Nov 16, 2017 @ 10:43
    mikkel
    0

    I want to make a page in frontend where people can write their review of my work. They must be able to write their name and a small report and a picture.

    How do I do that with doctypes and so on.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Nov 16, 2017 @ 10:49
    Michaël Vanbrabandt
    0

    Hi Mikkel,

    like I said if its just for sending as an email you don't need to use Document Types.

    You just need to create a view model called ReviewViewModel which contains your properties like Name, Image and Description.

    Then you need to create a SurfaceController called ReviewSurfaceController which contains an action for rendering your form view and an action method for gattering the form data using your ReviewViewModel and send it as an email to the correct person(s).

    Model

    using System;
    using System.Collections.Generic;
    using System.ComponentModel.DataAnnotations;
    using System.Linq;
    using System.Web;
    
    namespace Project.Models
    {
        public class ReviewViewModel
        {
    
            [Required]
            [Display(Name = "Name")]
            public string Name { get; set; }
    
            [Required]
            [Display(Name = "Description")]
            public string Description { get; set; }
    
        }
    }
    

    Controller

    using Project.Models;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Net.Mail;
    using System.Text;
    using System.Web;
    using System.Web.Mvc;
    using Umbraco.Core.Logging;
    using Umbraco.Core.Models;
    using Umbraco.Web.Mvc;
    
    namespace Project.Controllers
    {
    
        public class ReviewSurfaceController : SurfaceController
        {
            /// <summary>
            /// Render the review form
            /// </summary>
            /// <returns></returns>
            public ActionResult Add()
            {
                return PartialView("");
            }
    
            [HttpPost]
            [ValidateAntiForgeryToken]
            public ActionResult Send(ReviewViewModel model)
            {
                if (!ModelState.IsValid)
                    return CurrentUmbracoPage();
    
                // Send mail
    
                return RedirectToCurrentUmbracoPage();
            }
        }
    }
    

    Hope this helps.

    /Michaël

  • mikkel 143 posts 365 karma points
    Nov 17, 2017 @ 10:40
    mikkel
    0

    I think my word choice was wrong I meant more like testomonials. I'm not interested in sending or receiving emails. I do not know what's best for a user to create an account, and to write testomonials or if users just have to do it in front than one way or another.

Please Sign in or register to post replies

Write your reply to:

Draft