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.
Create a SurfaceController called ReviewController where you call the partial view which contains the form for the front end
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
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.
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();
}
}
}
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.
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.
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.
ReviewController
where you call the partial view which contains the form for the front endSend
. Here you can pass a new viewmodel calledReviewViewModel
which contains the form dataHope this helps!
Kind regards,
/Michaël
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.
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 likeName
,Image
andDescription
.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 yourReviewViewModel
and send it as an email to the correct person(s).Model
Controller
Hope this helps.
/Michaël
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.
is working on a reply...