Beispiel #1
0
        public void RenderEntity(int id)
        {
            EntityDTO dto = data.GetOneEntity(id);

            dto.ExtractProperties();
            ProcessStrategy2 st       = new ProcessStrategy2();
            PageResponseDTO  response = new PageResponseDTO();

            response.BreadCrumbContent = BreadcrumbHelper.BuildBreadcrumbContent(dto);
            response.Header            = dto.Name;
            response.Content           = MainContentBuilder.BuildContent(dto);
            switch (dto.Type)
            {
            case 111:
                response.RenderType = "process";
                break;

            case 142:
                response.RenderType = "subprocess";
                break;

            case 145:
                response.RenderType = "st2020";
                break;

            default:
                break;
            }
            this.view.RenderContent(response);
        }
Beispiel #2
0
        public async Task <IActionResult> GetPageByIdAsync(RequestBase <PageRequestDTO> req)
        {
            try
            {
                //// sample Call By postman:
                //{
                //    "UserName": "******",
                //    "Password": "******",
                //    "RequestPayload":
                //    { "Id": 2 }
                //}

                CheckPass(req.UserName, req.Password);

                var resultValue = await pageRepository.GetPageByIdAsync(req.RequestPayload.Id);

                var response = new PageResponseDTO
                {
                    pageText         = resultValue.PageText,
                    pageTitle        = resultValue.PageTitle,
                    shortDescription = resultValue.ShortDescription
                };
                if (resultValue != null)
                {
                    return(Ok(response));
                }
                else
                {
                    return(NotFound());
                }
            }
            catch (Exception ex)
            {
                return(BadRequest(JsonConvert.SerializeObject(ex.Message)));
                //return JsonConvert.SerializeObject(ex.Message);
            }
        }