Files
WatchIt/WatchIt.WebAPI/WatchIt.WebAPI.Validators/Accounts/AccountProfileBackgroundRequestValidator.cs

14 lines
525 B
C#
Raw Normal View History

2024-11-05 20:04:15 +01:00
using FluentValidation;
using WatchIt.Common.Model.Accounts;
using WatchIt.Database;
namespace WatchIt.WebAPI.Validators.Accounts;
public class AccountProfileBackgroundRequestValidator : AbstractValidator<AccountProfileBackgroundRequest>
{
public AccountProfileBackgroundRequestValidator(DatabaseContext database)
{
RuleFor(x => x.Id).MustBeIn(database.MediaPhotoImages.Where(x => x.MediaPhotoImageBackground != null), x => x.Id)
.WithMessage("Image has to be background");
}
}