Exemplo n.º 1
0
 public ActionResult EditPublication(int? id)
 {
     ViewBag.ImagePath = "/Images/No-Image.png";
     if (id == null)
     {
         return View();
     }
     else
     {
         PublicationModel model = new PublicationModel(publicationRepository.GetPublicationById((int)id), publicationRepository.GetTopicsToPublication((int)id));
         if (model.LinkToCover != null)
             ViewBag.ImagePath = model.LinkToCover;
         return View(model);
     }
 }
Exemplo n.º 2
0
 public ActionResult UpdatePublications(PublicationModel model)
 {
     string[] topics = model.Topics.Split(',');
     List<string> topicsList = new List<string>();
     foreach(string item in topics)
     {
         if (item.Trim() != String.Empty)
         {
             topicsList.Add(item.Trim());
         }
     }
     publicationRepository.SavePublication(model, topicsList.ToArray());
     return RedirectToAction("PublicationsControl");
 }