Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

This project was created for the purpose of experiment. No longer supported!

License

Notifications You must be signed in to change notification settings

rasulhsn/DynamicVNET.AspNetCore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DynamicVNET For Asp.Net Core - Overview [BETA]

NuGet

This project was created for the purpose of experiment. No longer supported!

Support

  • Profile Validations.
  • Works with ModelState Errors.

Asp.Net Core Example

Validation Model

// Simulation
 public class ViewModel
 {
        public string Id { get; set; }
 }

Step : Startup.ConfigureServices

public void ConfigureServices(IServiceCollection services)
{
            services.AddProfileValidation(validator =>
            {
                validator.AddProfile<ViewModel>("StrProfile", marker =>
                {
                    marker
                    .Required(x => x.Id)
                       .StringLen(x => x.Id, 3);
                });

                validator.AddProfile<ViewModel>("PhoneProfile", marker =>
                {
                    marker
                        .Required(x => x.Id)
                        .PhoneNumber(x => x.Id)
                        .Range(x => x.Id, 7, 12);
                });
            });

            // other .......
}

Step : Any Controller Action Implementation

public class HomeController : Controller
{
        public IActionResult Index()
        {
            return View();
        }

        [ProfileVNET]
        public IActionResult Contact([ProfileBind("PhoneProfile")]ViewModel model,[ProfileBind("StrProfile")]ViewModel model2)
        {
            if(!ModelState.IsValid)
                ViewData["Message"] = "Error Model";
            else
                ViewData["Message"] = "Success Model";

            return View();
        }
}

Where can I get it?

Install DynamicVNET.AspNetCore from the package manager console:

PM> Install-Package DynamicVNET.Lib.AspNetCore -Version 1.0.1-alpha

License & Copyright

DynamicVNET.AspNetCore is Copyright © 2018 Rasul Huseynov and lincensed under the MIT license.

About

This project was created for the purpose of experiment. No longer supported!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages