Exemple #1
0
 public ActionResult <IEnumerable <ReservationGetDTO> > Get([FromQuery] ReservationSearch request)
 {
     try
     {
         var response = _getReservationsCommmand.Execute(request);
         return(Ok(response));
     }
     catch
     {
         return(StatusCode(500, "Server error, try later"));
     }
 }
 public IActionResult MyProfile(int id)
 {
     try
     {
         if (HttpContext.Session.Get <ShowUserDto>("User") == null)
         {
             TempData["error"] = "You must log in order to browse your profile.";
             return(RedirectToAction("Index"));
         }
         ViewBag.Roles = getRoles.Execute(new RoleQuery {
             PerPage = 100
         }).Data;
         ViewBag.Reservations = getReservations.Execute(new ReservationQuery {
             UserId = id, EndTime = DateTime.Now, PerPage = 50
         }).Data;
         return(View(getUser.Execute(id)));
     }
     catch (Exception e)
     {
         TempData["error"] = e.Message;
     }
     return(RedirectToAction("Index"));
 }
Exemple #3
0
 public IActionResult Get([FromQuery] ReservationQuery query)
 {
     try
     {
         return(Ok(getReservations.Execute(query)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
 }