Пример #1
0
        public async Task <IActionResult> GetAsync([FromRoute] Guid vlogId)
        {
            // Act.
            var vlog = await _vlogService.GetAsync(vlogId);

            // Map.
            VlogDto output = _mapper.Map <VlogDto>(vlog);

            // Return.
            return(Ok(output));
        }
Пример #2
0
        public async Task <IActionResult> UpdateAsync([FromRoute] Guid vlogId, [FromBody] VlogDto input)
        {
            // Map.
            var vlog = _mapper.Map <Vlog>(input);

            vlog.Id = vlogId;

            // Act.
            await _vlogService.UpdateAsync(vlog);

            // Return.
            return(NoContent());
        }
Пример #3
0
        public IActionResult PostVlog([FromServices] DispatchManager dispatchManager, [FromServices] Core.AppContext appContext, [FromBody] VlogDto input)
        {
            // Act.
            var postVlogContext = new PostVlogContext
            {
                IsPrivate = input.IsPrivate,
                UserId    = appContext.UserId,
                VlogId    = input.Id,
            };

            dispatchManager.Dispatch <PostVlogBackgroundTask>(postVlogContext);

            // Return.
            return(NoContent());
        }