Example #1
0
 public ApiResponse Book(BookingArgs args)
 {
     return(TryInvoce(() => new ApiResponse
     {
         Lang = Language,
         Error = _bookingService.BookApi(args)
     }));
 }
Example #2
0
        public string BookApi(BookingArgs args)
        {
            if (
                args == null || args.UserId == Guid.Empty || args.MaidId == Guid.Empty)
            {
                return
                    (BshkaraRes.Booking_NotEnoughData);
            }
            var booking = UnitOfWork.Context.Set <BookingEntity>().FirstOrDefault(book =>
                                                                                  book.MaidId == args.MaidId && book.UserId == args.UserId && !book.IsDeleted);

            if (booking == null)
            {
                try
                {
                    InsertOrUpdate(
                        new BookingEntity
                    {
                        BookingStatus = BookingStatus.Boocked,
                        MaidId        = args.MaidId,
                        UserId        = args.UserId,
                        IsDeleted     = false,
                        Notes         = args.Notes
                    }
                        );
                }
                catch (
                    Exception ex)
                {
                    return
                        (ex.Message);
                }

                return(null);
            }

            return(BshkaraRes.Booking_AlreadyBooked);
        }