Пример #1
0
 public bool DeleteBooking(string bookingId)
 {
     try
     {
         int                   bId = int.Parse(bookingId);
         BookingEntities       ctx = new BookingEntities();
         BoatBooking           b   = ctx.BoatBooking.Where(x => x.Id == bId).First();
         BookingCancelledModel cm  = new BookingCancelledModel
         {
             UserEmail        = b.Member.Email,
             UserName         = b.Member.Name,
             SailingClub      = ConfigurationManager.AppSettings["SailingClub"],
             Signature        = ConfigurationManager.AppSettings["Signature"],
             BookingReference = b.BookingMemberId.ToString() + "/" + b.Id.ToString(),
             BookingDate      = b.BookingDate
         };
         ctx.BoatBooking.Remove(b);
         ctx.SaveChanges();
         UserMailer     um  = new UserMailer();
         MvcMailMessage msg = um.BoatCancelledTreasurer(cm);
         msg.Send();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }