Пример #1
0
        public async Task <IActionResult> Get(Guid id)
        {
            try
            {
                var link = await _friendLinkService.GetAsync(id);

                if (null == link)
                {
                    return(NotFound());
                }

                var obj = new FriendLinkEditModel
                {
                    Id      = link.Id,
                    LinkUrl = link.LinkUrl,
                    Title   = link.Title
                };

                return(Ok(obj));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(string.Empty, e.Message);
                return(StatusCode(StatusCodes.Status500InternalServerError));
            }
        }
Пример #2
0
        public async Task <IActionResult> Get([NotEmpty] Guid id)
        {
            var link = await _friendLinkService.GetAsync(id);

            if (null == link)
            {
                return(NotFound());
            }

            return(Ok(link));
        }