public IHttpActionResult EditPublication([FromBody] PublicationModel publication)
 {
     if (ModelState.IsValid)
     {
         var publicationDTO = new PublicationDTO
         {
             Header = publication.Header,
             Author = new UserDTO {
                 Email = User.Identity.Name
             },
             Content      = publication.Content,
             UsersWhoLike = null,
             Id           = publication.Id
         };
         _publicationService.Edit(publicationDTO);
         return(Ok("Publication was edite"));
     }
     return(BadRequest(" model is not valid"));
 }
        public ActionResult Edit(PublicationEditViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(View(viewModel));
            }

            // viewModel to Publication entity
            Publication editedPublication = new Publication()
            {
                Id           = viewModel.Id,
                Title        = viewModel.Title,
                Description  = viewModel.Description,
                Slug         = viewModel.Slug,
                Note         = viewModel.Note,
                AnimalSizeId = viewModel.AnimalSizeId,
                AnimalTypeId = viewModel.AnimalTypeId,
                StatusId     = viewModel.StatusId,
            };

            _publicationService.Edit(editedPublication);
            return(RedirectToAction("Index"));
        }