示例#1
0
        public async Task <RequestDetailsDto> GetRequestDetails(int id)
        {
            RequestDetailsDto detailsDto = new RequestDetailsDto
            {
                RequestId = id,
                Images    = (await _requestImages.GetAllListAsync(x => x.RequestId == id))
                            .Select(x => x.Image).ToList(),
                Description = (await _requestRepository.GetAsync(id)).Description
            };

            return(detailsDto);
        }
示例#2
0
        public async Task <IActionResult> AddPostDetailsRequest([FromBody] RequestDetailsDto requestDetailsDto)
        {
            IActionResult result;

            try
            {
                result = await ProcessRequestAsync(requestDetailsDto);
            }
            catch (Exception ex)
            {
                _logger.LogError($"[{LogDescription()}] Ex: {ex}");
                result = InternalServerError(ex.Message);
            }

            return(result);
        }
        [AllowAnonymous] //todo: дыра в безопасности?
        public ActionResult Details(long id)
        {
            var request = RequestDataStore.Get(id);

            var dto = new RequestDetailsDto
            {
                Id            = request.Id,
                State         = request.State.GetDisplay(),
                AuthorName    = request.Author.Name,
                CategoryName  = request.Category.Name,
                ConsumerName  = request.ConsumerName,
                Date          = request.Date,
                Comment       = request.Comment,
                Phone         = request.Phone,
                WorkerComment = request.WorkerComment
            };

            return(View(dto));
        }
示例#4
0
        public MessageListResult ValidateGetPostDetails(RequestDetailsDto requestDetailsDto)
        {
            MessageListResult result = new MessageListResult();

            // validating
            if (requestDetailsDto == null)
            {
                result.MessageList.Add("Null input.");
            }
            else if (string.IsNullOrWhiteSpace(requestDetailsDto.Url))
            {
                result.MessageList.Add("Null url.");
            }
            else if (!requestDetailsDto.Url.IsValidUri())
            {
                result.MessageList.Add("Invalid url.");
            }

            // preparing result
            PrepareResult(result);

            return(result);
        }