Get the App
SLTechnology News&Howtos  ›  Development  › 

How to understand the structure of ASP.NET MVC5 website Development Consulting Management

Shulou Source: shulou.com Published: 2022-06-03 09:30:42 10月03日 Update

This article introduces the relevant knowledge of "how to understand the framework of ASP.NET MVC5 website development and consulting management". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

I. General explanation

1. Realize the function

2. Class diagram

Since most of the classes are implemented in the article section, there is only one more Consultation class.

Second, create a consulting model class

Add the class Consultation (consultation model) to the Ninesky.Models project, which, like Article, is an extension of CommonModel.

1. Add Consultation class.

Using System;using System.ComponentModel.DataAnnotations;namespace Ninesky.Models {/ Consulting Model / create: 2014.02.06 / / public class Consultation {[Key] public int ConsultationID {get; set;} / name / [Display (Name = "name")] [Required (ErrorMessage= "required")] public string Name {get; set } / QQ number / [Display (Name = "QQ number")] [StringLength (16 minimum numbers 6, ErrorMessage = "{1}-{0} digits")] public string QQ {get; set } / Email address / [Display (Name = "Email address")] [DataType (DataType.EmailAddress,ErrorMessage= "must enter the correct Email address")] public string Email {get; set } / content / [Display (Name = "content")] [Required (ErrorMessage = "required")] [StringLength (1000, ErrorMessage = "must be less than {0} characters")] public string Content {get; set;} / whether it is public / [Display (Name = "public")] public bool IsPublic {get; set } / reply content / [Display (Name = "reply content")] public string ReplyContent {get; set;} / reply time / [Display (Name = "reply time")] public Nullable ReplyTime {get; set;}

2. Add foreign keys to CommonModel

Add a controller

Open the Ninesky.Web project to add a 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 {/ consult the controller / [Authorize] public class ConsultationController: Controller {private InterfaceCommonModelService commonModelService; public ConsultationController () {commonModelService = new CommonModelService ();}

The model is the foreign key of CommonModel, so you just need to operate on CommonModel directly. There is no need to add DAL,BLL, so the content is relatively simple.

This is the end of the content of "how to understand the architecture of ASP.NET MVC5 website development and consulting management". Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Content consulting model website address controller control architecture website development development management name article time more knowledge project practical successful next Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Tech Info vpn Linux MySQL