Architecture of ASP. NET MVC5 website development consulting management (11), mvc5 website development

Source: Internet
Author: User

Architecture of ASP. NET MVC5 website development consulting management (11), mvc5 website development

I. General description
1. Implement Functions

2. Class Diagram

Because most classes are implemented in this article, only one Consultation class is added here.
Ii. Create a consulting Model
Add the Consultation class (consulting model) to the Ninesky. Models project. This model is similar to the CommonModel extension of Article.
1. Add the 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")] public string Name {get; set ;}/// <summary> /// QQ No. /// </summary> [Display (Name = "QQ number")] [StringLength (16, MinimumLength = 6, ErrorMessage = "{1}-{0} digits")] public string QQ {get; set ;} /// <summary> /// Email address /// </summary> [Display (Name = "Email address")] [DataType (DataType. emailAddress, ErrorMessage = "the correct Email address must be entered")] 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 make public /// </summary> [Display (Name = "public")] public bool IsPublic {get; set ;} /// <summary> /// reply content /// </summary> [Display (Name = "Reply content")] public string ReplyContent {get; set ;} /// <summary> /// response time /// </summary> [Display (Name = "reply time")] public Nullable <DateTime> ReplyTime {get; set ;}}}

2. Add a foreign key to CommonModel

3. Add a controller
Open the Ninesky. Web project and add the Consultation controller in the Member area.

Using Ninesky. BLL; using Ninesky. IBLL; using Ninesky. models; using System. linq; using System. web. mvc; namespace Ninesky. web. areas. member. controllers {// <summary> // query Controller /// </summary> [Authorize] public class ConsultationController: Controller {private InterfaceCommonModelService commonModelService; public ConsultationController () {commonModelService = new CommonModelService ();}}}

The model is the foreign key of the CommonModel. During the operation, you can directly perform the CommonModel operation without adding DAL and BLL. The content is relatively simple.

A series of articles on ASP. NET MVC5 website development are coming to an end soon. I hope these articles can help you better Develop ASP. NET MVC5 website.

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: info-contact@alibabacloud.com 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.