1632738405
Zam Core Library
Core library for all the packages built by zamstation.
Check out all the components in detail here
final ParameterizedBuilder<Type, Car> carBuilder;
// ...
final car = carBuilder(HondaCivic);
final ParameterizedCallback<double, int> roundOffStrategy;
// ...
final price = roundOffStrategy(8.458);
Wrapper around the built-in Exception
class.
Provides more classified details of the exception like severity
and solution
.
Construct it with a simple problem statement.
final exception = NamedException.create('Provided value is -26 which is negative.');
or build it with more details.
final exception = NamedException.create(
'Provided value is -26 which is negative.'
solution: 'Please provide a positive value.'
severity: ExceptionSeverity.critical,
);
@immutable
class Triangle implements Cloneable<Triangle> {
final double base;
final double height;
const Triangle(this.base, this.height);
@override
Triangle clone() {
return Triangle(this.base, this.height);
}
}
@immutable
class BmiModel extends Model {
final double weight;
final double height;
final double value;
@override
get props => [weight, height];
const BmiModel(this.weight, this.height) : value = weight / (height * height);
}
@immutable
class HeightViewModel extends ViewModel {
final double value;
@override
get props => [value];
const HeightViewModel(this.value);
}
@immutable
class BmiEntity extends Entity<BmiModel> {
final String key = '';
final double weight;
final double height;
@override
get props => [weight, height];
const BmiEntity({
required this.weight,
required this.height,
});
BmiEntity.fromJson(Json json)
: this(
weight: json['weight'] as double,
height: json['height'] as double,
);
BmiEntity.fromModel(BmiModel model)
: this(
weight: model.weight,
height: model.height,
);
@override
Json toJson() {
return {
'key': this.key,
'weight': this.weight,
'height': this.height,
};
}
@override
BmiModel toModel() {
return BmiModel(this.weight, this.height);
}
}
To learn more, move on to the example section or check out these dedicated examples in github.
Run this command:
With Dart:
$ dart pub add zam_core
With Flutter:
$ flutter pub add zam_core
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get
):
dependencies:
zam_core: ^0.6.0
Alternatively, your editor might support dart pub get
or flutter pub get
. Check the docs for your editor to learn more.
Now in your Dart code, you can use:
import 'package:zam_core/zam_core.dart';
import 'package:zam_core/zam_core.dart';
void main() {
//
// Cloneable
//
final triangle = Triangle(6, 4);
final clonedTriangle = triangle.clone();
assert(triangle != clonedTriangle);
//
// Exceptions
//
final emptyException = NamedException.empty();
print(emptyException);
// EmptyException has occured.
// > Problem: <none>
// > Solution: <none>
final unnamedException = NamedException.create(
'Provided value is -26 which is negative.',
);
print(unnamedException);
// UnnamedException has occured.
// > Problem: Provided value is -26 which is negative.
// > Solution: <none>
final heightException = NamedException.create(
'Provided value is -26 which is negative.',
solution: 'Provide a positive value.',
name: 'Height Exception',
);
print(heightException);
// Height Exception has occured.
// > Problem: Provided value is -26 which is negative.
// > Solution: Provide a positive value.
}
@immutable
class Triangle implements Cloneable<Triangle> {
final double base;
final double height;
const Triangle(this.base, this.height);
@override
Triangle clone() {
return Triangle(base, height);
}
}
@immutable
class BmiModel extends Model {
final double weight;
final double height;
final double value;
@override
get props => [weight, height];
const BmiModel(this.weight, this.height) : value = weight / (height * height);
}
@immutable
class HeightViewModel extends ViewModel {
final double value;
@override
get props => [value];
const HeightViewModel(this.value);
}
@immutable
class BmiEntity extends Entity<BmiModel> {
@override
final String key = '';
final double weight;
final double height;
@override
get props => [weight, height];
const BmiEntity({
required this.weight,
required this.height,
});
BmiEntity.fromJson(Json json)
: this(
weight: json['weight'] as double,
height: json['height'] as double,
);
BmiEntity.fromModel(BmiModel model)
: this(
weight: model.weight,
height: model.height,
);
@override
Json toJson() {
return {
'key': key,
'weight': weight,
'height': height,
};
}
@override
BmiModel toModel() {
return BmiModel(weight, height);
}
}
Download Details:
Author: zamstation
Source Code: https://github.com/zamstation/zam_core
1602560783
In this article, we’ll discuss how to use jQuery Ajax for ASP.NET Core MVC CRUD Operations using Bootstrap Modal. With jQuery Ajax, we can make HTTP request to controller action methods without reloading the entire page, like a single page application.
To demonstrate CRUD operations – insert, update, delete and retrieve, the project will be dealing with details of a normal bank transaction. GitHub repository for this demo project : https://bit.ly/33KTJAu.
Sub-topics discussed :
In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N).
From new project window, Select Asp.Net Core Web Application_._
Once you provide the project name and location. Select Web Application(Model-View-Controller) and uncheck HTTPS Configuration. Above steps will create a brand new ASP.NET Core MVC project.
Let’s create a database for this application using Entity Framework Core. For that we’ve to install corresponding NuGet Packages. Right click on project from solution explorer, select Manage NuGet Packages_,_ From browse tab, install following 3 packages.
Now let’s define DB model class file – /Models/TransactionModel.cs.
public class TransactionModel
{
[Key]
public int TransactionId { get; set; }
[Column(TypeName ="nvarchar(12)")]
[DisplayName("Account Number")]
[Required(ErrorMessage ="This Field is required.")]
[MaxLength(12,ErrorMessage ="Maximum 12 characters only")]
public string AccountNumber { get; set; }
[Column(TypeName ="nvarchar(100)")]
[DisplayName("Beneficiary Name")]
[Required(ErrorMessage = "This Field is required.")]
public string BeneficiaryName { get; set; }
[Column(TypeName ="nvarchar(100)")]
[DisplayName("Bank Name")]
[Required(ErrorMessage = "This Field is required.")]
public string BankName { get; set; }
[Column(TypeName ="nvarchar(11)")]
[DisplayName("SWIFT Code")]
[Required(ErrorMessage = "This Field is required.")]
[MaxLength(11)]
public string SWIFTCode { get; set; }
[DisplayName("Amount")]
[Required(ErrorMessage = "This Field is required.")]
public int Amount { get; set; }
[DisplayFormat(DataFormatString = "{0:MM/dd/yyyy}")]
public DateTime Date { get; set; }
}
C#Copy
Here we’ve defined model properties for the transaction with proper validation. Now let’s define DbContextclass for EF Core.
#asp.net core article #asp.net core #add loading spinner in asp.net core #asp.net core crud without reloading #asp.net core jquery ajax form #asp.net core modal dialog #asp.net core mvc crud using jquery ajax #asp.net core mvc with jquery and ajax #asp.net core popup window #bootstrap modal popup in asp.net core mvc. bootstrap modal popup in asp.net core #delete and viewall in asp.net core #jquery ajax - insert #jquery ajax form post #modal popup dialog in asp.net core #no direct access action method #update #validation in modal popup
1602564619
User registration and authentication are mandatory in any application when you have little concern about privacy. Hence all most all application development starts with an authentication module. In this article, we will discuss the quickest way to use **ASP.NET Core Identity for User Login and Registration **in a new or existing MVC application.
Sub-topics discussed :
ASP.NET Core Identity is an API, which provides both user interface(UI) and functions for user authentication, registration, authorization, etc. Modules/ APIs like this will really be helpful and fasten the development process. It comes with ASP.NET Core Framework and used in many applications before. Which makes the API more dependable and trustworthy.
ASP.NET Core MVC with user authentication can easily be accomplished using Identity.UI. While creating the MVC project, you just need to select Authentication as Individual User Accounts.
The rest will be handled by ASP.NET Core Identity UI. It already contains razor view pages and backend codes for an authentication system. But that’s not what we want in most of the cases. we want to customize ASP.NET Core Identity as per our requirement. That’s what we do here.
First of all, I will create a brand new ASP.NET Core MVC application without any authentication selected. We could add ASP.NET Core Identity later into the project.
In Visual Studio 2019, Go to File > New > Project (Ctrl + Shift + N). From new project window, select ASP.NET Core Web Application.
Once you provide the project name and location. A new window will be opened as follows, Select _Web Application(Model-View-Controller), _uncheck _HTTPS Configuration _and DO NOT select any authentication method. Above steps will create a brand new ASP.NET Core MVC project.
#asp.net core article #asp.net core #add asp.net core identity to existing project #asp.net core identity in mvc #asp.net core mvc login and registration #login and logout in asp.net core
1583377668
#Asp.net core #Asp.net core mvc #Core #Asp.net core tutorials #Asp.net core with entity framework
1583378723
#Asp.net core #Asp.net core mvc #Core #Asp.net core tutorials #Asp.net core with entity framework
1583392491
#Asp.net core #Asp.net core mvc #Core #Asp.net core tutorials #Asp.net core with entity framework