コード例 #1
0
 private static Option <Domain.Entities.Restaurant, Error> UserShouldNotRateOwnRestaurant(
     Domain.Entities.Restaurant restaurant,
     Guid userId) =>
 restaurant.NoneWhen(r =>
                     r.OwnerId == userId,
                     Error.Validation("User cannot rate he/her's own restaurant."));
コード例 #2
0
 private static Option <Domain.Entities.Restaurant, Error> RestaurantOwnerShouldRegisterMeal(
     Domain.Entities.Restaurant restaurant,
     Guid userId) =>
 restaurant.NoneWhen(r => r.OwnerId != userId, Error.Unauthorized("Current user is not the restaurant owner!"));