Exemple #1
0
 public bool CreateRentalPlace(RentalPlace rentalPlace, string userId)
 {
     try
     {
         if (!Rentals.Items.SelectMany(x => x.Places).Any(x => x.RentalId == rentalPlace.RentalId && x.Name == rentalPlace.Name.Trim()))
         {
             rentalPlace.Name        = rentalPlace.Name.Trim();
             rentalPlace.UserCreated = userId;
             var rental = Rentals.FindById(rentalPlace.RentalId);
             rental.Places.Add(rentalPlace);
             Rentals.Update(rental);
             return(true);
         }
     }
     catch (Exception e)
     {
     }
     return(false);
 }