MagnusMinds.Utility 5.0.3 License Info

MagnusMinds.Utility 5.0.3

This package is useful for the business logic to more secure and standardise the code. It's useful to test how our controller behaves based on the validity of the inputs and validate its response based on the result of the operation it performs.

APIDefaultResponseModel

Return different-different types of response

CommonHelper

Checking email

IPAddress validations

Return random Integer/Digit

Checking strings are null or empty

Compares two arrays

Encryption

Create Encrypt and decrypt to your string or JSON

EnumExtention

Convert List to Oject

HttpRequestExtensions

Provides extension methods

JsonSerializeDeserializer

Convert JSON String to Object and Object to JSON

Session Extensions

Extensions of Session

WebHelper

Gets whether the request is made with AJAX

Get IP address from HTTP context

Check whether current HTTP request is available

XMLSerializeDeSerialize

Serializes an object

De-serializes an XML file into an object list

Serializes and Deserializes datetime

Encode and decode your attributes

EmailSender

Send an email by sending email Configuration

You need to Just add configuration in your appSetting.json file

"EmailConfiguration": {
"From": "YOUR_EMAIL_ADDRESS",
"SmtpServer": "smtp.gmail.com",
"Port": PORT_NO,
"Username": "YOUR_EMAIL_ADDRESS",
"Password": "YOUR_EMAIL_PASSWORD"
}

In your starup.cs file

services.ConfigureEmail(Configuration.GetSection("EmailConfiguration").Get<EmailConfiguration>());

In your controller file

var message = new MimeMessage();
message.To.Add(new MailboxAddress(firstname,email));
message.Body = new TextPart("Plain") { Text = "Hello" };
try
{
     await _emailSender.SendEmailAsync(message);
}
catch (Exception ex)
{
     throw ex;
}

Dapper

Create CRUD Operation with Database using Connection String

You need to add Connection String in your appSetting.json file

"ConnectionStrings": {
"ServerConnectionString": "YOUR_CONNECTION_STRING"
}

In your starup.cs file

services.ConfigureDapper(Configuration.GetSection("ConnectionStrings").Get<ConnectionStrings>());

In your controller file

private readonly IRepositoryGeneric<Employees> _employeesRepo;

public EmployeesController(IRepositoryGeneric<Employees> employeesRepo)
{
     _employeesRepo = employeesRepo;
}

var getAllEmployee=_employeesRepo.GetAllAsync();

License

MIT