Exemple #1
0
        public HttpResponseMessage AddUpdateTable(TableInfoEntity tableRequest)
        {
            if (tableRequest == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, new ArgumentNullException(nameof(tableRequest))));
            }

            try
            {
                _bookingBL.AddUpdateTable(tableRequest);
            }
            catch (DbException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Connection error"));
            }
            catch (DuplicateNameException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.Conflict, ex.Message));
            }
            catch (Exception ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "An unexpected error occured"));
            }

            return(Request.CreateResponse(HttpStatusCode.Created));
        }
Exemple #2
0
        //public List<booking> GetDayBooking(DateTime bookingDateRequest)
        //{

        //    var response = new List<booking>();

        //    response.Add(new booking() { BookingId = "1", FirstName = "Vikas", LastName = "Sethia", BookingDate = DateTime.Now, PhoneNumber = "0789456123", NumberOfGuests = 2, StartTime = new TimeSpan(12, 30, 00), bookedtables = getTables(new List<int>() { 1 }) });
        //    response.Add(new booking() { BookingId = "1", FirstName = "Martin", LastName = "Karlsson", BookingDate = DateTime.Now, PhoneNumber = "0789456123", NumberOfGuests = 2, StartTime = new TimeSpan(12, 00, 00), bookedtables = getTables(new List<int>() { 2 }) });
        //    response.Add(new booking() { BookingId = "1", FirstName = "Jonas", LastName = "Wu", BookingDate = DateTime.Now, PhoneNumber = "0789456123", NumberOfGuests = 4, StartTime = new TimeSpan(12, 30, 00), bookedtables = getTables(new List<int>() { 3, 4 }) });

        //    return response;
        //}

        //private List<bookedtable> getTables(List<int> tableNumbers)
        //{
        //    var response = new List<bookedtable>();

        //    foreach (var item in tableNumbers)
        //    {
        //        response.Add(new bookedtable() { TableNumber = item, BookingId = "1" });
        //    }


        //    return response;
        //}

        public void AddUpdateTable(TableInfoEntity tableRequest)
        {
            var newTableDetails = new tableinfo()
            {
                IsDeleted   = false,
                Capacity    = tableRequest.Capacity,
                IsBookable  = tableRequest.IsBookable,
                Xposition   = tableRequest.Xposition,
                Yposition   = tableRequest.Yposition,
                TableNumber = tableRequest.TableNumber,
                TableName   = tableRequest.TableName,
                ShapeId     = tableRequest.ShapeId,
                CustomerId  = _customerId
            };

            _dataAccess.AddUpdateTable(newTableDetails);
        }
Exemple #3
0
        static void Main(string[] args)
        {
            TableInfoEntity table = DBEntityHelper.GetTableInfo(@"H:\githubformine\MyUtils\ConsoleApplication\", "TCInterVacationCommon", "ImageBasicInfo");

            DBEntityHelper.SetModel(table);
        }