022 Second View (Enterprise) - chempkovsky/CS82ANGULAR GitHub Wiki

Definition

read the following article as reminder

Steps required to accomplish the task

Run ModelViews Wizard

repeat the steps described in the article

First page of the Wizard

repeat the steps described in the article

Second page of the Wizard

repeat the steps described in the article

Third page of the Wizard

  • On the third page of the Wizard we select Entity for the View. Choose PhBkEntity.csproj and PhbkEnterprise-class and click Next-button
Click to show the picture

project structure

Fourth page of the Wizard

repeat the steps described in the article

Fifth page of the Wizard

  • On the fifth page of the Wizard we define subset of properties, we turn on Jenerate JsonProperty Attribute-CheckBox, we Title and Plural Title for the given view. Click Next-button.
Click to show the picture

project structure

Sixth page of the Wizard

repeat the steps described in the article

Seventh page of the Wizard

repeat the steps described in the article

The PhbkEnterpriseView.cs will be created in the PhBk-folder of the PhBkViews.csproj-project

Click to show the code
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Linq.Expressions;


namespace PhBkViews.PhBk {
    public class PhbkEnterpriseView {
        // [JsonProperty(PropertyName = "entrprsId")]
        [JsonPropertyName("entrprsId")]
        [Required]
        [Display(Description="Row id",Name="Id of the Enterprise",Prompt="Enter Enterprise  Id",ShortName="Enterprise Id")]
        public System.Int32  EntrprsId { get; set; }

        // [JsonProperty(PropertyName = "entrprsName")]
        [JsonPropertyName("entrprsName")]
        [Required]
        [Display(Description="Name of the Enterprise",Name="Name of the Enterprise",Prompt="Enter Enterprise Name",ShortName="Enterprise Name")]
        [StringLength(20,MinimumLength=3,ErrorMessage="Invalid")]
        public System.String  EntrprsName { get; set; } = null!;

        // [JsonProperty(PropertyName = "entrprsDesc")]
        [JsonPropertyName("entrprsDesc")]
        [Display(Description="Description of the Enterprise",Name="Description of the Enterprise",Prompt="Description Enterprise Name",ShortName="Enterprise Description")]
        [StringLength(250,ErrorMessage="Invalid")]
        public System.String ?  EntrprsDesc { get; set; }

    }
}

Eighth page of the Wizard

repeat the steps described in the article

Ninth page of the Wizard

repeat the steps described in the article

The PhbkEnterpriseViewPage.cs will be created in the PhBk-folder of the PhBkViews.csproj-project

Click to show the code
//using System;
//using System.Collections.Generic;
//using System.ComponentModel.DataAnnotations;
//using System.Linq;
//using System.Linq.Expressions;
// using Newtonsoft.Json;
// using Newtonsoft.Json.Serialization;


namespace PhBkViews.PhBk {

    public class PhbkEnterpriseViewPage {
        public int page { get; set; }
        public int pagesize { get; set; }
        public int pagecount { get; set; }
        public int total { get; set; }
        public List<PhbkEnterpriseView> items { get; set; } = null!;
    }

}

Repo file

  • After Save-operation in the solution folder the Wizard's repo file will be created(or updated).
  • A separate repo file is created for each DbContext.
  • The repo file is updated only when you click the save button.
Click to show the picture

project structure

⚠️ **GitHub.com Fallback** ⚠️