Пример #1
0
        public static async Task <List <CtbMenuItem> > GetMenuItemsAsync(
            MenuItemsRequest menuRequest)
        {
            List <CtbMenuItem> menuItemsAsync = await CartableManager.ctbHandler.GetMenuItemsAsync(menuRequest);

            return(menuItemsAsync);
        }
Пример #2
0
        public async Task <HttpResponseMessage> GetMenuItems([FromBody] MenuItemsRequest request)
        {
            try
            {
                SecurityManager.ThrowIfUserContextNull();

                if (!request.RoleId.HasValue)
                {
                    if (SecurityManager.CurrentUserContext.IsOperatorPersonnelUser())//|| SecurityManager.CurrentUserContext.IsKargozariPersonnelUser())
                    {
                        request.RoleId = SecurityManager.CurrentUserContext.Roles[0].RoleID;
                    }

                    else
                    {
                        throw new OMFValidationException("نقش یا سمت کاربر مشخص نمی باشد");
                    }
                }

                if (!request.UserId.HasValue)
                {
                    request.UserId = SecurityManager.CurrentUserContext.UserId;
                }

                List <CtbMenuItem> menuItems = new List <CtbMenuItem>();
                menuItems = await CartableManager.GetMenuItemsAsync(request);

                return(Request.CreateResponse(HttpStatusCode.OK, new { resultCode = (int)ResultCode.Successful, data = menuItems }));
            }
            catch (Exception ex)
            {
                return(await this.HandleExceptionAsync(ex));
            }
        }
Пример #3
0
 public static List <CtbMenuItem> GetMenuItems(MenuItemsRequest menuRequest)
 {
     return(CartableManager.ctbHandler.GetMenuItems(menuRequest));
 }