public ActionResult Update(int AdId)
 {
     _createRemoveFollowerCommand.Execute(new CreateFollowerDto()
     {
         AdId   = AdId,
         UserId = GetUserId().Result
     });
     return(RedirectToAction("Index", "Home"));
 }
Exemplo n.º 2
0
        public IActionResult Create([FromBody] AdFollowerViewModel viewModel)
        {
            try
            {
                _createRemoveFollowerCommand.Execute(new CreateFollowerDto()
                {
                    AdId   = viewModel.AdId,
                    UserId = GetUserId().Result
                });

                return(StatusCode(201));
            }
            catch (EntityNotFoundException e)
            {
                return(UnprocessableEntity(e.Message));
            }
            catch (Exception e)
            {
                return(StatusCode(500, e.Message));
            }
        }