MVC5 website Development Consulting Management Architecture (11) _ Practical Skills

Source: Internet
Author: User

I. GENERAL description
1, realize the function

2. Class Diagram

Since most of the classes are implemented in the article, there is only one more consultation class.
Ii. Creating consulting model classes
Add the class consultation (consulting model) to the Ninesky.models project, which is a commonmodel extension similar to article.
1, add consultation class.

 using System; using System.ComponentModel.DataAnnotations; namespace Ninesky.models {///<summary>///Consulting model///<remarks> create:2014.02.06</remarks>///</

    Summary> public class Consultation {[Key] public int Consultationid {get; set;} <summary>///name///</summary> [Display (name = "name")] [Required (errormessage= "required")] P

    Ublic string Name {get; set;} <summary>///QQ number///</summary> [Display (Name = "QQ number")] [Stringlength (16,minimumlength=6

    , errormessage = "{1}-{0} number")] public string QQ {get; set;} <summary>///Email address///</summary> [Display (Name = "email address")] [DataType (Datatype.emaila

    Ddress,errormessage= "must enter the correct email address")] public string Email {get; set;}
    <summary>///content///</summary> [Display (Name = "content"]] [Required (errormessage = "required")][Stringlength (1000, errormessage = "must be less than {0} characters")] public string Content {get; set;} <summary>///whether to expose///</summary> [Display (Name = "whether public")]] publicly bool IsPublic {get; set ; ///<summary>///reply content///</summary> [Display (Name = "Reply Content")] public string Replyconte

    NT {get; set;}  <summary>///reply Time///</summary> [Display (Name = "Reply Time")] public nullable<datetime>
  replytime {get; set;} }

2, add the foreign key in the Commonmodel

Third, add controller
Open Ninesky.web Project Add consultation controller to Member area

Using Ninesky.models;
Using System.Linq;

Namespace Ninesky.Web.Areas.Member.Controllers
  ///Advisory Controller
  ///</summary >
  [Authorize] public
  class Consultationcontroller:controller
    private Interfacecommonmodelservice Commonmodelservice;

    Public Consultationcontroller () {commonmodelservice = new Commonmodelservice ();}}}

The model is Commonmodel foreign key, the operation directly to the Commonmodel operation on the line, do not need to add dal,bll, the content is relatively simple.

About MVC5 website development A series of articles finishing is nearing the end, hope these articles can help everybody to develop the MVC5 website better.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.