public ActionResult Edit(int?id) { ViewBag.AnimalSizeId = new SelectList(_animalSizeService.GetAllWeb(), "Id", "Name"); ViewBag.AnimalTypeId = new SelectList(_animalTypeService.GetAllWeb(), "Id", "Name"); if (id == null) { return(RedirectToAction("Index")); } var editedPublication = _publicationService.GetAdmin(id); if (editedPublication == null) { return(RedirectToAction("Index")); } PublicationEditViewModel viewModel = new PublicationEditViewModel() { Id = editedPublication.Id, Title = editedPublication.Title, Description = editedPublication.Description, Slug = editedPublication.Slug, Note = editedPublication.Note, AnimalSizeId = editedPublication.AnimalSizeId, AnimalTypeId = editedPublication.AnimalTypeId, StatusId = editedPublication.StatusId, }; return(View(viewModel)); }