public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BookingViewModel booking = _bookingManager.GetBooking(id);

            if (booking == null)
            {
                return(HttpNotFound());
            }
            return(View(booking));
        }
        // GET: Bookings/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Booking booking = bookingManager.GetBooking(id.Value);

            if (booking == null)
            {
                return(NotFound());
            }

            return(View(booking));
        }
        // GET: Booking/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BookingViewModel booking = _bookingManager.GetBooking(id);

            ViewBag.VehicleId = new SelectList(_vehicleManager.GetAllVehicle().Where(a => a.VehicleId == booking.VehicleId), "VehicleId", "LicencePlate", selectedValue: booking.VehicleId);
            ViewBag.ServiceId = new SelectList(_serviceManager.GetAllService().Where(a => a.ServiceId == booking.ServiceId), "ServiceId", "ServiceName", selectedValue: booking.ServiceId);
            ViewBag.Status    = new SelectList(_serviceManager.GetAllServiceStatus(), "Id", "Status", selectedValue: booking.Status);
            if (booking == null)
            {
                return(HttpNotFound());
            }
            return(View(booking));
        }
        // GET: Booking/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            BookingView booking = _bookingManager.GetBooking(id);

            if (booking.UserId != _userManager.findUser(User.Identity.Name).Id)
            {
                return(HttpNotFound());
            }
            if (booking == null)
            {
                return(HttpNotFound());
            }
            return(View(booking));
        }
Esempio n. 5
0
 public IHttpActionResult GetBooking(string Userid)
 {
     try
     {
         return(Ok(bookingManager.GetBooking(Convert.ToInt32(Userid))));
     }
     catch (Exception)
     {
         return(NotFound());
     }
 }
        public IHttpActionResult GetBooking(int id)
        {
            Booking booking = _bookingManager.GetBooking(id);

            if (booking == null)
            {
                return(Json("No record found."));
            }

            return(Ok(booking));
        }
Esempio n. 7
0
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            BookingView bookings = _bookingManager.GetBooking(id);
            UserView    user     = _userManager.findUserById(bookings.UserId);

            ViewBag.UserEmail = user.Email;
            VehicleView vehicle = _VehicleManager.getVehicle(bookings.VehicleId);

            ViewBag.LicensePlate = vehicle.LicensePlate;
            ServiceView service = _serviceManager.GetService(bookings.ServiceId);

            ViewBag.ServiceName = service.ServiceName;
            if (bookings == null)
            {
                return(HttpNotFound());
            }
            return(View(bookings));
        }
Esempio n. 8
0
        public IActionResult Get(long id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var result = bookingManager.GetBooking(id);

            if (result == null)
            {
                return(NotFound(id));
            }

            return(this.HAL(result, new Link[] {
                new Link(Link.RelForSelf, $"/api/v1/bookings/{id}"),
                new Link("bookingsList", "/api/v1/bookings", "Bookings list"),
            }));
        }
Esempio n. 9
0
 public IHttpActionResult GetBookingById(int id)
 {
     return(Ok(_bookingManager.GetBooking(id)));
 }