Ejemplo n.º 1
0
        public ActionResult Create(Code codes, string[] language, string[] tags, HttpPostedFileBase img)
        {
            var coo  = new FunctionsController();
            var id   = coo.Cookie();
            var idus = coo.CookieID();

            if (id == null)
            {
                return(Redirect("/Users/Login"));
            }
            else
            {
                //var tag = "";
                //foreach (var item in tags)
                //{
                //    tag += item + ";";
                //}
                //codes.code_tag = tag;
                codes.user_id  = idus.user_id;
                codes.code_img = images.UpLoadImages(img, null, "Codes");


                History history = new History()
                {
                    user_id        = idus.user_id,
                    his_datecreate = DateTime.Now,
                    his_content    = idus.user_name + " đã thêm code " + codes.code_title + " thành công!"
                };
                db.Historys.Add(history);

                codesDAO.Create(codes, language);

                return(RedirectToAction("MyCodes"));
            }
        }