Esempio n. 1
0
        public ActionResult LoadArticle(ContentModelLoad model)
        {
            ContentModel modelo = new ContentModel();
            List<CategoryModel> cateList = new List<CategoryModel>();
            foreach (var item in model.CategoriesId)
            {
                cateList.Add(catRepository.Get(item));
            }
            modelo.Comments = new List<CommentModel>();
            modelo.Categories = cateList;
            modelo.Content = model.Content;
            modelo.DatePosted = DateTime.Now;
            modelo.IsActive = model.IsActive;
            modelo.IsFeatured = model.IsFeatured;
            modelo.IsImportant = model.IsImportant;
            modelo.Resume = model.Resume;
            modelo.Title = model.Title;
            UserModel us = userRepository.GetByMail(model.UserMail);
            if (us == null)
            {
                us = new UserModel();
                us.FirstDateOn = DateTime.Now;
                us.LastDateOn = DateTime.Now;
                us.UserMail = model.UserMail;
                us.UserName = model.UserName;
                // userRepository.Save(us);
            }
            modelo.User = us;
            repository.SaveContent(modelo);

            return View ("LoadImages", modelo.Id);
        }
Esempio n. 2
0
 public ActionResult LoadArticle(string pass)
 {
     if (String.IsNullOrEmpty(pass) || pass != "Federo@1357//Edimburgo@2017")
     {
         return RedirectToAction("Lista", "Articulos", null);
     }
     ContentModelLoad model = new ContentModelLoad();
     model.AllCategories = catRepository.GetAll();
     model.CategoriesId = new List<Int32>();
     return View(model);
 }