Exemple #1
0
        public async Task <IActionResult> GetPageGroupByIdAsync(PageGroupRequestDTO req)
        {
            try
            {
                //// sample Call By postman:
                //    { "Id": 2 }

                var resultValue = await pageGroupRepository.GetPageCountByGroupIdAsync(req.Id);

                if (resultValue != null)
                {
                    var response = new PageGroupResponseDTO
                    {
                        TitlePageGroup = resultValue.GroupTitle,
                        CountPage      = resultValue.PageCount
                    };
                    return(Ok(response));
                }
                else
                {
                    return(NotFound(new { message = "اطلاعاتی یافت نشد" }));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(JsonConvert.SerializeObject(ex.Message)));
            }
        }
Exemple #2
0
        public async Task <IActionResult> GetPageGroupByIdAsync(RequestBase <PageGroupRequestDTO> req)
        {
            try
            {
                //// sample Call By postman:
                //{
                //    "UserName": "******",
                //    "Password": "******",
                //    "RequestPayload":
                //    { "Id": 2 }
                //}

                CheckPass(req.UserName, req.Password);

                var resultValue = await pageGroupRepository.GetPageCountByGroupIdAsync(req.RequestPayload.Id);

                var response = new PageGroupResponseDTO
                {
                    TitlePageGroup = resultValue.GroupTitle,
                    CountPage      = resultValue.PageCount
                };
                if (resultValue != null)
                {
                    return(Ok(response));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(JsonConvert.SerializeObject(ex.Message)));
            }
        }