Exemplo n.º 1
0
        public ActionResult ListNormalApp()
        {
            var modelListApp    = articleService.GetListTypeNull();
            var apiModelListApp = ArticleViewModels.MapFromBOs(modelListApp);

            return(View("ListNormalApp", apiModelListApp));
        }
Exemplo n.º 2
0
        public ActionResult HotelWebsiteDesign()
        {
            var bo = articlesService.GetItem("TKTWKS");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
Exemplo n.º 3
0
        public ActionResult HospitalityPropertyManagementSoftwareNamoly()
        {
            var bo = articlesService.GetItem("PMQLKSN");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
Exemplo n.º 4
0
        public ActionResult NamolyEnterprise()
        {
            var bo = articlesService.GetItem("PMQLNHKSSN");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
Exemplo n.º 5
0
        public ActionResult HotelBookingEngine()
        {
            var bo = articlesService.GetItem("PMDPTT");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult FarmingManagementSofwareNafaly()
        {
            var bo = articlesService.GetItem("PMQLTTN");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult SteelTradingBusinessManagementSofwareNAANSteel()
        {
            var bo = articlesService.GetItem("PMQLNVTMTN");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult BuiltOnDemandAccociationManagementSoftware()
        {
            var bo = articlesService.GetItem("PMQLTCHH");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult BuiltOnDemandDMS()
        {
            var bo = articlesService.GetItem("PMQLCCU");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult SeoConsultingServices()
        {
            var bo = articlesService.GetItem("DVCTTHW");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult BuiltOnDemandWebsite()
        {
            var bo = articlesService.GetItem("TVTKWTNC");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
        public ActionResult BuiltOnDemandMarketingGame()
        {
            var bo = articlesService.GetItem("TCQCTHSP");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
Exemplo n.º 13
0
        public ActionResult NamolySpaProfessional()
        {
            var bo = articlesService.GetItem("PMQLSN");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
Exemplo n.º 14
0
        public ActionResult ContentManagementSoftware()
        {
            var bo = articlesService.GetItem("PMQLTLDT");
            ArticleViewModels article = new ArticleViewModels();

            article.MapFromBO(bo);
            return(View(article));
        }
Exemplo n.º 15
0
        public ActionResult Create(ArticleViewModels item, HttpPostedFileBase urlImage)
        {
            article articlex = new article();

            //Import Image
            if (urlImage == null || urlImage.ContentLength == 0)
            {
                ViewBag.disabled = true;
                ViewBag.Error    = "Please select a valid image ";
                return(View("Create"));
            }//end if
            else
            {
                if (ModelState.IsValid && urlImage.FileName.ToLower().EndsWith("jpg") || urlImage.FileName.ToLower().EndsWith("png") || urlImage.FileName.ToLower().EndsWith("jepg"))
                {
                    string pathImage = Server.MapPath("~/Content/" + urlImage.FileName);
                    if (System.IO.File.Exists(pathImage))
                    {
                        System.IO.File.Delete(pathImage);
                    }//end if
                    urlImage.SaveAs(pathImage);

                    articlex.body      = item.Body;
                    articlex.name      = item.Name;
                    articlex.image     = urlImage.FileName;
                    articlex.date      = DateTime.Now;;
                    articlex.favourite = false;
                    articlex.other     = "v";
                    articlex.user      = null;

                    /*Using Web Service*/

                    //HttpClient Client = new HttpClient();
                    //Client.BaseAddress = new Uri("http://localhost:18080/");
                    //Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                    ////HttpResponseMessage response = Client.GetAsync("pidev-web/rest/article").Result;
                    //Client.PostAsJsonAsync<article>("pidev-web/rest/article", articlex).ContinueWith((postTask) => postTask.Result.EnsureSuccessStatusCode());

                    /*Using DbContext*/
                    //ctx.article.Add(articlex);
                    //ctx.SaveChanges();
                    /*Using designe pattern*/
                    serviceArticle.Add(articlex);
                    serviceArticle.Commit();

                    return(RedirectToAction("index"));
                }//end if
                else
                {
                    ViewBag.disabled = true;
                    ViewBag.Error    = "File type is not valid";
                    return(RedirectToAction("Create"));
                }
            }//end else
        }
Exemplo n.º 16
0
        public ActionResult EditArticle(ArticleViewModels article)
        {
            if (ModelState.IsValid)
            {
                var mapper     = new MapperConfiguration(cfg => cfg.CreateMap <ArticleViewModels, DTOArticle>()).CreateMapper();
                var DTOArticle = mapper.Map <ArticleViewModels, DTOArticle>(article);
                postService.EditArticleDTO(DTOArticle);
            }

            return(RedirectToAction("ListOfArticles", "Post"));
        }
Exemplo n.º 17
0
        // GET: Article

        public ActionResult Index()
        {
            List <article>           a;
            List <ArticleViewModels> listView = new List <ArticleViewModels>();
            //using (ProjectModel ctx = new ProjectModel())
            //{
            //    a = ctx.article.ToList();

            //    foreach (article x in a)
            //    {
            //        ArticleViewModels art = new ArticleViewModels();
            //        art.Id = x.id;
            //        art.Name = x.name;
            //        art.Image = x.image;
            //        art.Body = x.body;
            //        art.Date = DateTime.Now;
            //        listView.Add(art);
            //    }
            //}

            HttpClient Client = new HttpClient();

            Client.BaseAddress = new Uri("http://localhost:18080/");
            Client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            HttpResponseMessage response = Client.GetAsync("pidev-web/rest/article").Result;

            if (response.IsSuccessStatusCode)
            {
                a = response.Content.ReadAsAsync <IEnumerable <article> >().Result.ToList();
                foreach (article x in a)
                {
                    ArticleViewModels art = new ArticleViewModels();
                    art.Id    = x.id;
                    art.Name  = x.name;
                    art.Image = x.image;
                    art.Body  = x.body;
                    art.Date  = DateTime.Now;
                    listView.Add(art);
                }
            }
            else
            {
                ViewBag.result = "error";
            }

            return(View(listView));
        }
Exemplo n.º 18
0
        public ActionResult Edit(int id)
        {
            ArticleViewModels art = new ArticleViewModels();
            var result            = ctx.article.Where(x => x.id == id);

            art.Id    = result.FirstOrDefault().id;
            art.Name  = result.FirstOrDefault().name;
            art.Body  = result.FirstOrDefault().body;
            art.Image = result.FirstOrDefault().image;

            if (result.Count() <= 0)
            {
                return(RedirectToAction("index"));
            }

            return(View(art));
        }
Exemplo n.º 19
0
        //[DnnAuthorize(AllowAnonymous = true)]
        public HttpResponseMessage GetArticles(int moduleId)
        {
            try
            {
                //todo: get the latest X articles?
                var articles = ArticleController.GetArticles(moduleId);

                //because of the circular reference when cerealizing the taxonomy within content items we have to build out our article view models manually.
                var cleanArticles = new List <ArticleViewModel>();
                foreach (Article a in articles)
                {
                    var newArt = new ArticleViewModel
                    {
                        ArticleId            = a.ArticleId,
                        Body                 = WebUtility.HtmlDecode(a.Body),
                        CreatedByUser        = a.CreatedByUser,
                        CreatedByUserId      = a.CreatedByUserId,
                        CreatedOnDate        = a.CreatedOnDate,
                        Description          = WebUtility.HtmlDecode(a.Description),
                        LastModifiedByUser   = a.LastUpdatedByUser,
                        LastModifiedByUserId = a.LastModifiedByUserId,
                        LastModifiedOnDate   = a.LastModifiedOnDate,
                        ModuleId             = a.ModuleId,
                        Title                = a.Title,
                        url = DotNetNuke.Common.Globals.NavigateURL(a.TabID, "", "&aid=" + a.ArticleId)
                    };
                    cleanArticles.Add(newArt);
                }

                var articleViewModels = new ArticleViewModels
                {
                    Articles = cleanArticles
                };

                return(Request.CreateResponse(HttpStatusCode.OK, articleViewModels, new MediaTypeHeaderValue("text/json")));
                //to force JSON as the result
                //return Request.CreateResponse(HttpStatusCode.OK, articleViewModels, new MediaTypeHeaderValue("text/json"));
            }
            catch (Exception exc)
            {
                DnnLog.Error(exc);                                                             //todo: obsolete
                return(Request.CreateResponse(HttpStatusCode.BadRequest, "error in request")); //todo: probably should localize that?
            }
        }
Exemplo n.º 20
0
        public ActionResult CreateArticle(string title, DateTime publishdate, string tag, string note, int category)
        {
            ArticleViewModels article = new ArticleViewModels()
            {
                Title       = title,
                PublishDate = publishdate,
                Tag         = tag,
                Note        = note,
                Category_Id = category
            };

            if (ModelState.IsValid)
            {
                var mapper     = new MapperConfiguration(cfg => cfg.CreateMap <ArticleViewModels, DTOArticle>()).CreateMapper();
                var DTOArticle = mapper.Map <ArticleViewModels, DTOArticle>(article);
                postService.CreateArticleDTO(DTOArticle);
            }

            return(RedirectToAction("ListOfArticles", "Post"));
        }
Exemplo n.º 21
0
        public ActionResult Edit(ArticleViewModels item, HttpPostedFileBase urlImage)
        {
            var result = ctx.article.Where(x => x.id == item.Id);

            result.FirstOrDefault().name = item.Name;

            result.FirstOrDefault().body = item.Body;

            //Import Image
            if (urlImage == null || urlImage.ContentLength == 0)
            {
                ViewBag.disabled = true;
                ViewBag.Error    = "Please select a valid image ";
                return(View("Edit"));
            }//end if
            else
            {
                if (urlImage.FileName.ToLower().EndsWith("jpg") || urlImage.FileName.ToLower().EndsWith("png") || urlImage.FileName.ToLower().EndsWith("jepg"))
                {
                    string pathImage = Server.MapPath("~/Content/" + urlImage.FileName);
                    if (System.IO.File.Exists(pathImage))
                    {
                        System.IO.File.Delete(pathImage);
                    }//end if
                    result.FirstOrDefault().image = urlImage.FileName;
                    ctx.SaveChanges();
                    urlImage.SaveAs(pathImage);
                }  //end if
                else
                {
                    ViewBag.disabled = true;
                    ViewBag.Error    = "File type is not valid";
                    return(View(item));
                }
            }//end else

            return(RedirectToAction("index"));
        }
 public ActionResult BuiltOnDemandDMSAdd(ArticleViewModels article)
 {
     if (ModelState.IsValid)
     {
         try
         {
             LuceneViewModels luceneViewModels = new LuceneViewModels();
             luceneViewModels.Id          = article.Id;
             luceneViewModels.Title       = article.TitleVN;
             luceneViewModels.Url         = article.UrlVN.Replace("-", " ").Trim();
             luceneViewModels.Description = article.MetaDescriptionVN;
             luceneViewModels.AvatarUrl   = article.ImageAvatarVN;
             var lucene = luceneViewModels.MapToBO();
             var bo     = article.MapToBO();
             if (article.Id > 0)
             {
                 articlesService.UpdateItem(bo);
                 GoLucene.AddUpdateLuceneIndex(lucene);
             }
             else
             {
                 articlesService.AddItem(bo);
                 GoLucene.AddUpdateLuceneIndex(lucene);
             }
         }
         catch (Exception e)
         {
             ViewData["EditError"] = e.Message;
         }
     }
     else
     {
         ViewData["EditError"] = "Please, correct all errors.";
     }
     return(RedirectToAction("BuiltOnDemandDMS"));
 }
Exemplo n.º 23
0
        public ActionResult Create([Bind(Include = "Pseudo, Titre, Contenu, Image")] ArticleViewModels articleVm)
        {
            if (!ModelState.IsValid)
            {
                return(View(articleVm));
            }


            if (articleVm.Image != null)
            {
                bool HasError = false;
                if (articleVm.Image.ContentLength > 1024 * 1024)
                {
                    ModelState.AddModelError("Image", "Le fichier téléchargé est trop grand.");
                    HasError = true;
                }
                if (!AcceptedTypes.Contains(articleVm.Image.ContentType) || AcceptedExt.Contains(Path.GetExtension(articleVm.Image.FileName).ToLower()))
                {
                    ModelState.AddModelError("Image", "Le fichier doit etre une image.");
                    HasError = true;
                }
                try
                {
                    //Afin d'éviter les doublons de nom de fichier on leur attribut un identifiant unique avec GUID
                    Guid id = Guid.NewGuid();
                    UFileName = Path.GetFileName(articleVm.Image.FileName);
                    // On nettoie le nom du fichier en remplacant les caractères spéciaux par... be rien en fait, on les supprime et on passe le résultat en minuscule
                    string valeurSortie = Regex.Replace(UFileName, "[éèà' !?ê]", "").ToLower();
                    imageFileName = id.ToString() + "-" + valeurSortie;
                    string ImagePath = Path.Combine(Server.MapPath("~/Content/Upload/"), imageFileName);
                    articleVm.Image.SaveAs(ImagePath);
                    using (MemoryStream ms = new MemoryStream())
                    {
                        articleVm.Image.InputStream.CopyTo(ms);
                        byte[] array = ms.GetBuffer();
                    }
                }
                catch
                {
                    UFileName = "";
                    ModelState.AddModelError("Image", "Erreur à l'enregistrement.");
                    HasError = true;
                }
                if (HasError)
                {
                    return(View(articleVm.Image));
                }
            }


            Article article = new Article
            {
                Pseudo    = articleVm.Pseudo,
                Titre     = articleVm.Titre,
                Contenu   = articleVm.Contenu,
                ImageName = imageFileName
            };

            Bdd.Articles.Add(article);
            Bdd.SaveChanges();
            return(RedirectToAction("List", "Article"));
        }