Exemplo n.º 1
0
        // GET: Roles
        public ActionResult Index([FromQuery] RoleSearch roleSearch)
        {
            roleSearch.PageNumber = 0;
            var roles = _searchRolesCommand.Execute(roleSearch);

            return(View(roles.Data));
        }
Exemplo n.º 2
0
 // GET: Users/Create
 public ActionResult Create()
 {
     try
     {
         ViewBag.Roles = getRoles.Execute(new RoleQuery()).Data;
         return(View());
     }
     catch (EntityNotAllowedException)
     {
         return(RedirectToAction("PageNotFound", "Redirections"));
     }
     catch (Exception e)
     {
         TempData["error"] = e.Message;
     }
     return(RedirectToAction(nameof(Create)));
 }
Exemplo n.º 3
0
        // GET: Roles
        public ActionResult Index(string sortOrder, string searchString, RoleQuery query)
        {
            ViewBag.RoleSortParam    = string.IsNullOrEmpty(sortOrder) ? "role_desc" : "";
            ViewBag.CurrentSortOrder = sortOrder;
            ViewBag.CurrentFilter    = searchString;

            var roles = _getRoles.Execute(query);

            return(View(roles));
        }
Exemplo n.º 4
0
 public ActionResult <IEnumerable <RoleDto> > Get([FromQuery] RoleQuery query)
 {
     try
     {
         return(Ok(_getRoles.Execute(query)));
     }
     catch (NotFoundException)
     {
         return(NotFound());
     }
 }
 public IActionResult Get(int id)
 {
     try
     {
         var search = new NameSearch
         {
             Id = id
         };
         var result = _getRoles.Execute(search);
         return(Ok(result.First()));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception e)
     {
         return(StatusCode(500, e.Message));
     }
 }
Exemplo n.º 6
0
 public IActionResult Get([FromQuery] RoleQuery query)
 {
     try
     {
         return(Ok(_getRolesCommand.Execute(query)));
     }
     catch (EntityNotFoundException)
     {
         return(NotFound());
     }
 }
Exemplo n.º 7
0
 public ActionResult <IEnumerable <RoleDTO> > GetRole([FromQuery] RuleSearch request)
 {
     try
     {
         var search = _getRolesCommand.Execute(request);
         return(Ok(search));
     }catch (Exception)
     {
         return(StatusCode(500, "Server error, try later"));
     }
 }
Exemplo n.º 8
0
 public IActionResult Get([FromQuery] RoleSearch dto)
 {
     try
     {
         var roles = _getCommand.Execute(dto);
         return(Ok(roles));
     }
     catch (Exception)
     {
         return(StatusCode(500, "An error occured"));
     }
 }
Exemplo n.º 9
0
 public IActionResult Get([FromQuery] RoleQuery query)
 {
     try
     {
         return(Ok(getRoles.Execute(query)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new
         {
             Errors = new List <string> {
                 e.Message
             }
         }));
     }
 }
Exemplo n.º 10
0
 public ActionResult Get([FromQuery] RoleSearch rs)
 {
     try
     {
         var getRolles = _getRoles.Execute(rs);
         return(Ok(getRolles));
     }
     catch (EntityNotFoundException e)
     {
         return(NotFound(e.Message));
     }
     catch (Exception)
     {
         return(StatusCode(500, "An error occured.Please try again later."));
     }
 }
Exemplo n.º 11
0
 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"));
 }
Exemplo n.º 12
0
 public ActionResult Get([FromQuery] RoleSearch criteria)
 => Ok(getRolesCommand.Execute(criteria));
Exemplo n.º 13
0
 public ActionResult <PagedResponse <RoleDto> > Get([FromQuery] RoleSearch roleSearch)
 => Ok(_searchRolesCommand.Execute(roleSearch));
Exemplo n.º 14
0
        public ActionResult <IEnumerable <RoleDto> > Get([FromQuery] RoleSearch search)
        {
            var result = _getCommand.Execute(search);

            return(Ok(result));
        }