I am new to Umbraco and have been working on my first project. I really like Umbraco so far, but I have hit a snag in trying to create a form. All the articles I read explaining how to create a form say to create a model and a controller.
This is my model and it is in a folder I created called Models
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace UmbracoTrial.Models
{
public class QuoteViewModel
{
[Required]
public string Name { get; set; }
public string Company { get; set; }
[Phone(ErrorMessage = "The phone number is invalid")]
[Required]
public string Phone { get; set; }
[Required]
[EmailAddress(ErrorMessage = "Email has to be a valid email address.")]
public string Email { get; set; }
public string Address { get; set; }
[Required]
public string City { get; set; }
[Required]
public string State { get; set; }
[Required]
[StringLength(10, MinimumLength = 5, ErrorMessage = "Zip code must be at least 5 numbers")]
public string Zip { get; set; }
public virtual ICollection<String> type_of_project { get; set; }
public string Date { get; set; }
public string Description { get; set; }
}
}
There are no errors in this, but when I made a controllers folder and created a controller, I get an error saying that the namespace Models does not exist in my project. Anyone know what's going on here?
Using Controllers and Models for Forms
Hello,
I am new to Umbraco and have been working on my first project. I really like Umbraco so far, but I have hit a snag in trying to create a form. All the articles I read explaining how to create a form say to create a model and a controller.
This is my model and it is in a folder I created called Models
There are no errors in this, but when I made a controllers folder and created a controller, I get an error saying that the namespace Models does not exist in my project. Anyone know what's going on here?
Hi Carson
Make sure you add the using statement at the top of the controller class
is working on a reply...