Posts

Showing posts with the label MVC

Custom Validation and Class Level validation using Data Annotation in MVC .Net core application

Image
 In Previous article i have demonstrated about " Validations using entity framework data annotation in .Net core MVC " where i have implemented ready made validation types in MVC application. In this article i will be demonstrating about custom validation and class level validation using Data Annotation in MVC .Net core application. The custom validation will be very useful when we need to solve real time scenario where the ready made validation will not work. I also going to show about the class level validation which is also a type of custom kind validation available in data annotation using entity framework. Lets start the implementation, I going to use the same application which i have used in previous article. First we need to add few columns in existing employee table for validation demonstration as below. DateOfBirth DateOfJoin DateOfExit  After adding above fields my model class will look like below using ModelsExample.Attributes; using System; using System.Co

Validations using entity framework data annotation in .Net core MVC

Image
 In previous article we have learnt about working with Drop down in .Net Core MVC . now in this article we will work with the validations using entity framework data annotation. To implement the validation we just need to write minimal code and you are done, you do not need to write extra code for handling validation of your form.  Lets start the implementation, I am going to use the same application for this implementation which i have used in previous article mentioned above. We will use below validation types in this article however there are more validation types available in entity framework data annotation (like Range validation,compare validation,Custom Validation and more)  . Required validation Regular Expression validation String Length validation Max Length validation  First we need to import " _ValidationScriptsPartial " partial class in our view where we need to implement the validation using below syntax. @Html.Partial("_ValidationScriptsPartial")

Working with Drop Down control in .Net Core MVC with steps

Image
In previous articles we have learned about code first approach , Entity migration, crud operation in MVC .NET core, in this article i am going to demonstrate about work with drop down control in .NET Core MVC application with JQuery drop down binding. I am going to use the same application which i have used in crud operation article. So lets start the implementation.       First we need to create the City and State models for that add below classes in ModelExample project.  CityMaster.cs using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text; namespace ModelsExample { [Table("CityMaster")] public class CityMaster { [Key] [Column("Id")] public int Id { get; set; } [Column("Name")] public string Name { get; set; } [Column(" StateMasterId ")] public int StateM

Deploy .NET Core MVC Application on Azure Cloud

Image
In this article I will be explaining about deploying .NET Core MVC Application on Azure Cloud step by step in detail.  There are following deployment stages involved  1) Signup in Azure 2) Creating a Resource Group 3) Creating a VM 4) Creating a Azure sql server Database 5) Publish your MVC Application 6) install IIS web server feature in VM 7) deploy your publish files in IIS       Lets discuss each steps in detail.   1) Signup in Azure  You can signup to azure using below link you will get 1 month free trial for using azure services. https://azure.microsoft.com/en-us/free/   once you signup with azure, you are ready to do the next steps in the article. 2) Creating a Resource Group login to azure portal where you can get links to use various services and home page look like below figure.   In above portal you can type "resource group" in search bar you can create the Resource Group. type the resource group name and select the desired region and click on review +create butt