
Visit our website: https://www.fitradar.me/ and join our team! Fitness is closer than you think!

Our Fitradar back-end solution is created based on Clean Architecture as described in this article and explained in this conference talk. One part of the back-end solution is incoming request validation, and in order to implement it as a part of the MediatR pipeline we are using FluentValidation library that replaces built-in ASP.NET Core validation system. At the beginning of the project it seemed that all we have to do is just to create a custom validator derived from AbstractValidator and perform the validation of an Application Model in a single class. And that is how we started to implement the validation. And since the library has quite enhanced capabilities that allow implementing complex validation rules for a while we didn’t notice any problems. Until the moment when we realized that not all validation rules are simple incoming Data Model validation. Some of the rules expressed our business logic rules and restrictions. And so we started to think about splitting the rules across the layers and following are multi step validation solution we came up with:
public sealed class EventCancellationValidator : EntityValidatorBase
{
public EventCancellationValidator()
{
AddValidation("CancellationTimeValidation",
new ValidationRule<SportEventInstance>(
new Specification<SportEventInstance>(sportEvent =>
sportEvent.StartTime > DateTime.UtcNow),
ValidationErrorCodes.CANCELLATION_TOO_LATE, "It is not possible to cancel the
Sport Event after it has started", "SportEventStartTime"));
}
}
P.S. Please follow our Facebook page for more!

Along with diet, exercise plays an important role in controlling your weight and preventing obesity. To maintain your weight, the calories you eat and drink must equal the energy you burn. To lose weight, you must use more calories than you eat and drink.
2. Reduce your risk of heart diseases.
Exercise strengthens your heart and improves your circulation. The increased blood flow raises the oxygen levels in your body. This helps lower your risk of heart diseases such as high cholesterol, coronary artery disease, and heart attack. Regular exercise can also lower your blood pressure and triglyceride levels.
3. Help your body manage blood sugar and insulin levels.
Exercise can lower your blood sugar level and help your insulin work better. This can cut down your risk for metabolic syndrome and type 2 diabetes. And if you already have one of those diseases, exercise can help you to manage it.
4. Improve your mental health and mood.
During exercise, your body releases chemicals that can improve your mood and make you feel more relaxed. This can help you deal with stress and reduce your risk of depression.
5. Strengthen your bones and muscles.
Regular exercise can help kids and teens build strong bones. Later in life, it can also slow the loss of bone density that comes with age. Doing muscle-strengthening activities can help you increase or maintain your muscle mass and strength.
6. Improve your sleep.
Exercise can help you to fall asleep faster and stay asleep longer.
7. Increase your chances of living longer.
Studies show that physical activity can reduce your risk of dying early from the leading causes of death, like heart disease and some cancers.
P.S. Visit our website: https://www.fitradar.me/ and join the waiting list. Fitness is closer than you think!
P.S.S. Text from MedlinePlus