Example #1
0
        public ActionResult Details(string se)
        {
            PostCategory2Controller.se = null;
            if (WebYoutube.Session.User.Email != null && WebYoutube.Session.User.Id != 0)
            {
                //lay ra email, info ng dung
                ViewBag.ViewBagEmail = WebYoutube.Session.User.Email;
                Data.DTO.PeopleInfomationDTO Infomation = new PeopleInfomationDTO();
                Infomation         = dao.Infomation(WebYoutube.Session.User.Email);
                ViewBag.Infomation = Infomation;

                //lay ra list video cua ng dung
                IEnumerable <Data.DTO.PeopleListVideoDTO> ListVideo;
                ListVideo         = dao.ListVideo(WebYoutube.Session.User.Id, se);
                ViewBag.ListVideo = ListVideo.ToList();

                // count like dis comment
                ViewBag.ListCount = dao.ListCount();

                return(View(ListVideo));
            }
            else
            {
                return(View());
            }
        }
Example #2
0
 public string EditInfo2(PeopleInfomationDTO dto)
 {
     try
     {
         var people = db.People.Find(dto.Id);
         people.FullName = dto.FullName;
         db.SaveChanges();
         return("");
     }
     catch (Exception ex)
     {
         return(ex.ToString());
     }
 }
Example #3
0
        public ActionResult EditInfo(int Id, HttpPostedFileBase image, PeopleInfomationDTO objec)
        {
            PostCategory2Controller.se = null;
            if (string.IsNullOrEmpty(objec.FullName) && image == null)
            {
                ModelState.AddModelError("", "Ten khong duoc bo trong");
            }
            else if (!string.IsNullOrEmpty(objec.FullName) && image == null)
            {
                var res = dao.EditInfo2(objec);
                var ob  = dao.ViewDetailsPerson(Id);
                WebYoutube.Session.User.FullName = ob.FullName;

                if (res == "")
                {
                    return(RedirectToAction("Details"));
                }
                else
                {
                    ModelState.AddModelError("", res);
                }
            }
            else if (string.IsNullOrEmpty(objec.FullName) && image != null)
            {
                var    FileName = Path.GetFileName(image.FileName);
                string path     = Path.Combine(Server.MapPath("~/Common/img"), FileName);
                image.SaveAs(path);

                objec.Immage = FileName;
                var res = dao.EditInfo3(objec);
                if (res == "")
                {
                    return(RedirectToAction("Details"));
                }
                else
                {
                    ModelState.AddModelError("", res);
                }
            }
            else if (!string.IsNullOrEmpty(objec.FullName) && image != null)
            {
                var    FileName = Path.GetFileName(image.FileName);
                string path     = Path.Combine(Server.MapPath("~/Common/img"), FileName);
                image.SaveAs(path);

                var ob = dao.ViewDetailsPerson(Id);
                WebYoutube.Session.User.FullName = ob.FullName;

                objec.Immage = FileName;
                var res = dao.EditInfo(objec);
                if (res == "")
                {
                    return(RedirectToAction("Details"));
                }
                else
                {
                    ModelState.AddModelError("", res);
                }
            }
            return(View(objec));
        }