Donate

ASP.NET MVC CRUD(Create/Update/Delete) With Dapper ORM

Hi All,

Here's an ASP.NET MVC CRUD(Create/Update/Delete) project with Dapper ORM. The model classes and interface are based from this post Using Dapper ORM in ASP.NET Web Forms with few modifications in Customer class. The updates are adding Display attribute and DisplayFormat attribute to CreditLimit and IntroDate properties.
using System;
using System.ComponentModel.DataAnnotations;

namespace ASPMVCDapper.Models
{
    public class Customer
    {
        public int CustomerID { get; set; }

        [Display(Name="Company Name")]
        public string CompanyName { get; set; }

        [Display(Name = "Address")]
        public string Address { get; set; }

        [Display(Name = "City")]
        public string City { get; set; }

        [Display(Name = "State")]
        public string State { get; set; }

        [Display(Name = "Intro Date")]
        [DisplayFormat(DataFormatString = "{0:yyyy-MM-dd}", ApplyFormatInEditMode = true)]
        public DateTime IntroDate { get; set; }

        [Display(Name = "Credit Limit")]
        [DisplayFormat(DataFormatString = "{0:n2}")]
        public decimal CreditLimit { get; set; }
    }
}
Output
ASP.NET MVC CRUD(Create/Update/Delete) Using Dapper ORM
See VB.NET version of this article here: ASP.NET MVC CRUD(Create/Update/Delete) With Dapper ORM in VB.NET
The source code and Create table script are available in Github ASP.NET MVC With Dapper.

Cheers!

Comments

Donate

Popular Posts From This Blog

WPF CRUD Application Using DataGrid, MVVM Pattern, Entity Framework, And C#.NET

How To Insert Or Add Emojis In Microsoft Teams Status Message

TypeScript Error Or Bug: The term 'tsc' is not recognized as the name of a cmdlet, function, script file, or operable program.