Esempio n. 1
0
 public ActionResult CreateGroup(string title, int userID)
 {
     if (ValidateTitle(title) && groupsDAO.AddNewGroup(title, userID))
     {
         Users user = usersDAO.GetByID(userID);
         return(RedirectToAction("FriendList", new { login = user.Login }));
     }
     else
     {
         Users user = usersDAO.GetByID(userID);
         return(RedirectToAction("FriendList", new { login = user.Login }));
     }
 }
Esempio n. 2
0
        public static HtmlString DrowAvatar(this HtmlHelper helper, int userID)
        {
            UsersDAO  usersDAO  = new UsersDAO();
            ImagesDAO imagesDAO = new ImagesDAO();
            Users     user      = usersDAO.GetByID(userID);

            if (user.Avatar != null)
            {
                Images     image     = imagesDAO.GetImage(user.Avatar);
                TagBuilder img       = new TagBuilder("img");
                string     attribute = "data:image;base64," + Convert.ToBase64String(image.Image);
                string     height    = "300px";
                string     width     = "300px";
                img.Attributes.Add("src", attribute);
                img.Attributes.Add("height", height);
                img.Attributes.Add("width", width);
                return(new HtmlString(img.ToString()));
            }
            else
            {
                TagBuilder label = new TagBuilder("label");
                label.SetInnerText("No avatar(");
                return(new HtmlString(label.ToString()));
            }
        }
Esempio n. 3
0
 public ActionResult MyProfile(int userID)
 {
     return(View("MyProfile", usersDAO.GetByID(userID)));
 }
Esempio n. 4
0
 public ActionResult ToChat(int interlocutorID)
 {
     ViewData["interlocutor"] = usersDAO.GetByID(interlocutorID);
     return(View("Chat"));
 }