public ValidationCommandResult IsValid(RoomCreateCommand createCommand) { if (createCommand.NumberOfPeople < 10) { return(ValidationCommandResult.NotValid("Room need more than 10 people minimum.")); } return(ValidationCommandResult.Valid()); }
public ValidationCommandResult IsValid(DeleteRoomCommand command) { var entity = _roomRepository.FirstOrDefault(command.Id); if (entity.Name == "John") { return(ValidationCommandResult.NotValid("Room Name is John")); } return(ValidationCommandResult.Valid()); }
public ValidationCommandResult IsValid(RoomCreateCommand createCommand) { var allCustomers = _customerRepository.GetAll().ToList(); if (allCustomers.Count > 0) { var firstCustomer = allCustomers.ToList()[0]; if (firstCustomer.FirstName == "John") { return(ValidationCommandResult.NotValid("First Customer Is John")); } } return(ValidationCommandResult.Valid()); }