Ejemplo n.º 1
0
        public ActionResult Create(Group group)
        {
            if (ModelState.IsValid)
            {
                var datein = DateTime.Now;
                group.DateIn = datein;
                var userID = new AccountController().GetonlineUser_ID();
                group.UserID = userID;
                var user = db.MembershipOfSites.Where(x => x.ID == userID).FirstOrDefault();
                var grade = db.Assistances.Select(x => x.GradeForCreateGroup).FirstOrDefault();
                user.Grade += grade;
                db.Groups.Add(group);
                db.SaveChanges();
                new UserLogsController().Create(new Log() { ActivityType = ActivityType.Create, CaseActivity = CaseActivity.Group, GroupID = group.ID });
                var groupx = db.Groups.Where(x => x.GroupSubject == group.GroupSubject && x.UserID == userID).FirstOrDefault();
                if (groupx != null)
                {
                    var reqgroup = new UserInGroup();
                    reqgroup.ID = Guid.NewGuid();
                    reqgroup.DateIn = DateTime.Now;
                    reqgroup.isAdminUser = true;
                    reqgroup.Status = true;
                    reqgroup.UserID = userID;
                    reqgroup.GroupID = groupx.ID;
                    db.UserInGroups.Add(reqgroup);
                    db.SaveChanges();
                }
                return RedirectToAction("Index");
            }

            ViewBag.UserID = new SelectList(db.MembershipOfSites, "ID", "Name", group.UserID);
            return View(group);
        }
Ejemplo n.º 2
0
 // GET: /Topic/Details/5
 public ActionResult Details(Guid? id)
 {
     var userid=new AccountController().GetonlineUser_ID();
     var bk = db.TopicBookMarks.Where(x => x.topicID == id && x.userID == userid).FirstOrDefault();
     if (bk!=null)
     {
         ViewBag.isBookmark = true;
     }
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Topic topic = db.Topics.Find(id);
     if (topic == null)
     {
         return HttpNotFound();
     }
     if (topic.CountVisit == null)
     {
         topic.CountVisit = 1;
     }
     else
     {
         topic.CountVisit += 1;
     }
     db.SaveChanges();
     return View(topic);
 }
Ejemplo n.º 3
0
        // GET: /Question/Details/5
        public ActionResult Details(Guid? id)
        {
            var userid=new AccountController().GetonlineUser_ID();
            ViewBag.userID = userid;
            var bm = db.QuestionBookMarks.Where(x => x.questionID == id && x.userID == userid).FirstOrDefault();
            if (bm!=null)
            {
                ViewBag.isBookmark = true;
            }
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }
            Question question = db.Questions.Find(id);
            if (question == null)
            {
                return HttpNotFound();
            }
            if (question.CountVisit == null)
            {
                question.CountVisit = 1;
                db.SaveChanges();
            }
            else
            {
                question.CountVisit += 1;
                db.SaveChanges();

            }
            return View(question);
        }
Ejemplo n.º 4
0
        public ActionResult Create(Answer answer, HttpPostedFileBase answerFile, string titleOfFIle, string RtnUrl)
        {
            if (ModelState.IsValid)
            {
			 var q = db.Questions.Find(answer.questionID);
                q.HasAnswer = true;
                answer.ID = Guid.NewGuid();
                answer.DateIn = DateTime.Now;
                answer.LikeCount = 0;
                answer.UnlikeCount = 0;
                answer.isBestAnswer = false;
                var useronline=new AccountController().GetonlineUser_ID();
                answer.UserID =useronline;
                var user = db.MembershipOfSites.Where(x => x.ID == useronline).FirstOrDefault();
                var grade = db.Assistances.Select(x => x.GradeForAnswer).FirstOrDefault();
                user.Grade += grade;
                if (answerFile != null)
                {
                    string filename = titleOfFIle + "--" + new Random().Next(int.MaxValue)+System.IO.Path.GetExtension(answerFile.FileName);
                    answer.filename = filename;
                    answerFile.SaveAs(Server.MapPath("~/Files/AnswerAttachment/" + filename));
                }
                db.Answers.Add(answer);
                db.SaveChanges();
                new UserLogsController().Create(new Log() { ActivityType = ActivityType.Create, CaseActivity = CaseActivity.Answers, QuestionID = answer.questionID, AnswerID = answer.ID });
                return Redirect(RtnUrl);
            }

            ViewBag.fatherAnswer = answer.fatherAnswer;
            ViewBag.qustionID = answer.questionID;
            return View(answer);
        }
Ejemplo n.º 5
0
 // GET: /PrivateMessage/Create
 public ActionResult Create(Guid userID)
 {
     var senderID = new AccountController().GetonlineUser_ID();
     ViewBag.receiverID = userID;
     ViewBag.senderID = senderID;
     ViewBag.receiverusername = db.MembershipOfSites.Where(x => x.ID == userID).Select(x => x.Username).FirstOrDefault();
     return View();
 }
Ejemplo n.º 6
0
 // GET: /Group/
 public ActionResult Index()
 {
     var userid = new AccountController().GetonlineUser_ID();
     ViewBag.userID = userid;
     var admingroup = db.UserInGroups.Where(x => x.isAdminUser == true && x.UserID == userid).ToList();
     ViewBag.admingroup = admingroup;
     var groups = db.Groups.Include(g => g.MembershipOfSite);
     return View(groups.ToList());
 }
Ejemplo n.º 7
0
        public ActionResult Create(Topic topic, HttpPostedFileBase[] TopicFile, string[] TitleFile, string KeyWords)
        {
            if (ModelState.IsValid)
            {

                topic.ID = Guid.NewGuid();
                topic.DateIn = DateTime.Now;
                var userID = new AccountController().GetonlineUser_ID();
                topic.UserID = userID;
                topic.CountVisit = 0;
                topic.LikeCount = 0;
                topic.UnlikeCount = 0;
                db.Topics.Add(topic);
                var user = db.MembershipOfSites.Where(x => x.ID == userID).FirstOrDefault();
                var grade = db.Assistances.Select(x => x.GradeForTopic).FirstOrDefault();
                user.Grade += grade;
                db.SaveChanges();
                if (!string.IsNullOrEmpty(KeyWords))
                {
                    string[] KeyWordComponnets = KeyWords.Split(',');
                    foreach (var item in KeyWordComponnets)
                    {
                        try
                        {
                            var KeyWordId = int.Parse(item);
                            db.KeywordOfPosts.Add(new KeywordOfPost() { ID = Guid.NewGuid(), keyWordID = KeyWordId, topicID = topic.ID });
                        }
                        catch
                        {
                            KeyWord K = new KeyWord() { title = item };
                            db.KeyWords.Add(K);
                            db.SaveChanges();
                            db.KeywordOfPosts.Add(new KeywordOfPost() { ID = Guid.NewGuid(), keyWordID = K.ID, topicID = topic.ID });
                        }
                    }
                    db.SaveChanges();
                }
                if (TopicFile != null && TopicFile.Length > 0 && TopicFile[0] != null)
                {
                    for (int i = 0; i < TopicFile.Length; i++)
                    {
                        string filename = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(TopicFile[i].FileName);
                        TopicFile[i].SaveAs(Server.MapPath("~/Files/TopicAttachments/" + filename));
                        db.TopicAttachments.Add(new TopicAttachment() { filename = filename, ID = Guid.NewGuid(), title = TitleFile[i], topicID = topic.ID });
                    }
                    db.SaveChanges();
                }
                new UserLogsController().Create(new Log() { ActivityType = ActivityType.Create, CaseActivity = CaseActivity.Topic, TopicID = topic.ID });
                return RedirectToAction("details", "SubCategory", new { id = topic.SubCategoryID });
            }

            ViewBag.SubCategoryID = new SelectList(db.SubCategories, "ID", "SubCategorySub", topic.SubCategoryID);
            return View(topic);
        }
Ejemplo n.º 8
0
        public ActionResult Create(Question question, HttpPostedFileBase[] questionFile, string[] titleofFile, string KeyWords)
        {
            if (ModelState.IsValid)
            {
                question.ID = Guid.NewGuid();
                question.createDate = DateTime.Now;
                var userID = new AccountController().GetonlineUser_ID();
                question.userID = userID;
                var user = db.MembershipOfSites.Where(x => x.ID == userID).FirstOrDefault();
                var grade = db.Assistances.Select(x => x.GradeForQuestion).FirstOrDefault();
                user.Grade += grade;
                db.SaveChanges();
                if (!string.IsNullOrEmpty(KeyWords))
                {
                    string[] KeyWordComponnets = KeyWords.Split(',');
                    foreach (var item in KeyWordComponnets)
                    {
                        try
                        {
                            var KeyWordId = int.Parse(item);
                            db.KeywordOfPosts.Add(new KeywordOfPost() { ID = Guid.NewGuid(), keyWordID = KeyWordId, questionID = question.ID });
                        }
                        catch
                        {
                            KeyWord K = new KeyWord() { title = item };
                            db.KeyWords.Add(K);
                            db.SaveChanges();
                            db.KeywordOfPosts.Add(new KeywordOfPost() { ID = Guid.NewGuid(), keyWordID = K.ID, questionID = question.ID });
                        }
                    }
                    db.SaveChanges();
                }
                if (questionFile != null && questionFile.Length > 0 && questionFile[0] != null)
                {
                    for (int i = 0; i < questionFile.Length; i++)
                    {
                        string filename = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(questionFile[i].FileName);
                        questionFile[i].SaveAs(Server.MapPath("~/Files/QuestionAttachments/" + filename));
                        db.QuestionAttachments.Add(new QuestionAttachment() { ID = Guid.NewGuid(), filename = filename, questionID = question.ID, title = titleofFile[i] });
                    }

                }
                db.Questions.Add(question);
                db.SaveChanges();
                new UserLogsController().Create(new Log() { ActivityType = ActivityType.Create, CaseActivity = CaseActivity.Question, QuestionID = question.ID });
                return RedirectToAction("details", "subcategory", new { id = question.subCategoryID }); ;
            }

            ViewBag.subCategoryID = new SelectList(db.SubCategories, "ID", "SubCategorySub", question.subCategoryID);
            return View(question);
        }
Ejemplo n.º 9
0
 public ActionResult Create([Bind(Include = "ID,CategorySub,CategoryDec,DateIn,UserID")] Category category)
 {
     if (ModelState.IsValid)
     {
         var UserOnlineID = new AccountController().GetonlineUser_ID();
         var user = db.MembershipOfSites.Where(x => x.ID == UserOnlineID).FirstOrDefault();
         var grade = db.Assistances.Select(x => x.GradeForCreateCategory).FirstOrDefault();
         user.Grade += grade;
         category.UserID = UserOnlineID;
         category.DateIn = DateTime.Now;
         db.Categories.Add(category);
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(category);
 }
Ejemplo n.º 10
0
        // GET: /Users/Details/5

        public ActionResult Details(Guid? id, string SuccessMessage, int? page)
        {
            if (id == null)
            {
                id = new AccountController().GetonlineUser_ID();
            }
            else
                return RedirectToAction("DetailsForOthers", new { id = id, SuccessMessage = SuccessMessage, page = page });
            if (!string.IsNullOrEmpty(SuccessMessage))
                ViewBag.SuccessMessage = SuccessMessage;

            MembershipOfSite membershipofsite = db.MembershipOfSites.Find(id);
            if (membershipofsite == null)
            {
                return HttpNotFound();
            }

            return View(membershipofsite);
        }
Ejemplo n.º 11
0
        public ActionResult Create([Bind(Include="ID,CategoryID,SubCategorySub,DateIn,UserID")] SubCategory subcategory)
        {
            if (ModelState.IsValid)
            {
                subcategory.DateIn = DateTime.Now;
                var userID = new AccountController().GetonlineUser_ID();
                subcategory.UserID = new AccountController().GetonlineUser_ID();
                db.SubCategories.Add(subcategory);
                var user = db.MembershipOfSites.Where(x => x.ID == userID).FirstOrDefault();
                var grade = db.Assistances.Select(x => x.GardeForCreateSubCategory).FirstOrDefault();
                user.Grade += grade;
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.CategoryID = new SelectList(db.Categories, "ID", "CategorySub", subcategory.CategoryID);
            ViewBag.UserID = new SelectList(db.MembershipOfSites, "ID", "Name", subcategory.UserID);
            return View(subcategory);
        }
Ejemplo n.º 12
0
 // GET: /Group/Details/5
 public ActionResult Details(int? id)
 {
     if (id == null)
     {
         return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
     }
     Group group = db.Groups.Find(id);
     var userOn = new AccountController().GetonlineUser_ID();
     var userInGroup = db.UserInGroups.Where(x => x.GroupID == group.ID && x.Status == true && x.UserID == userOn).ToList();
     if (userInGroup.Count() != 0)
     {
         ViewBag.isUserInGroup = true;
     }
     else
         ViewBag.isUserInGroup = false;
     if (group == null)
     {
         return HttpNotFound();
     }
     ViewBag.ShowLoadMore = (group.Posts.Count > 4) ? false : true;
     return View(group);
 }
Ejemplo n.º 13
0
        public ActionResult DetailsForOthers(Guid? id, string SuccessMessage, int? page)
        {
            if (id == null)
            {
                id = new AccountController().GetonlineUser_ID();
            }
            if (!string.IsNullOrEmpty(SuccessMessage))
                ViewBag.SuccessMessage = SuccessMessage;

            MembershipOfSite membershipofsite = db.MembershipOfSites.Find(id);
            if (membershipofsite == null)
            {
                return HttpNotFound();
            }
            page = page ?? 1;
            int PageSize = 5;
            int Offset = (((page ?? 1) - 1) * PageSize) + 1;
            var TopicR = db.TopicSearch(true, "", 0).Where(x => x.UserID == id).OrderByDescending(x => x.DateIn).Skip(Offset).Take(PageSize).ToList();
            int TotalTopics = db.Topics.Where(x => x.UserID == id).Count();
            var TopicsPage = new StaticPagedList<TopicList>(TopicR, page ?? 1 + 1, PageSize, TotalTopics);
            ViewBag.Topics = TopicR;
            ViewBag.TopicPage = TopicsPage;
            return View(membershipofsite);
        }
Ejemplo n.º 14
0
        public ActionResult Create(TopicComments topiccomments, string RtnUrl)
        {
            if (ModelState.IsValid)
            {
                topiccomments.ID = Guid.NewGuid();
                topiccomments.dateIn = DateTime.Now;
                topiccomments.HasAnswer = false;
                topiccomments.LikeCount = 0;
                topiccomments.UnlikeCount = 0;
                var UserOnlineID = new AccountController().GetonlineUser_ID();
                topiccomments.userCreator = UserOnlineID;
                db.TopicComments.Add(topiccomments);
                var user = db.MembershipOfSites.Where(x => x.ID == UserOnlineID).FirstOrDefault();
                var grade = db.Assistances.Select(x => x.GradeForAnswer).FirstOrDefault();
                user.Grade += grade;
                db.SaveChanges();
                new UserLogsController().Create(new Log() { CaseActivity = CaseActivity.CommentOfTopic, ActivityType = ActivityType.Create, TopicID = topiccomments.topicID, TopicComment = topiccomments.ID });
                return Redirect(RtnUrl ?? "/CommentOfTopic/Index");
            }

            ViewBag.fatherComment = topiccomments.fatherComment;
            ViewBag.topicID = topiccomments.topicID;
            return PartialView(topiccomments);
        }
Ejemplo n.º 15
0
 public ActionResult GetAllMessage()
 {
     var userID = new AccountController().GetonlineUser_ID();
     var messages = db.PrivateMessages.Where(x => x.receiverID == userID).OrderByDescending(x => x.dateCreated).ToList();
     return View("~/Views/Users/GetNewMessage.cshtml", messages);
 }
Ejemplo n.º 16
0
 public int GetNewMessageCount()
 {
     var userID = new AccountController().GetonlineUser_ID();
     var messages = db.PrivateMessages.Where(x => x.receiverID == userID && x.read == false).ToList();
     int num = messages.Count();
     return num;
 }
Ejemplo n.º 17
0
 public ActionResult GetNewMessage()
 {
     var userID = new AccountController().GetonlineUser_ID();
     var messages = db.PrivateMessages.Where(x => x.receiverID == userID && x.read == false).ToList();
     return View(messages);
 }
Ejemplo n.º 18
0
 public int GetNewNotificationCount()
 {
     var useronline = new AccountController().GetonlineUser_ID();
     var noti = db.Notifications.Where(x => x.receiverID == useronline && x.status == false).ToList();
     int num = noti.Count();
     return num;
 }
Ejemplo n.º 19
0
 public ActionResult GetAllNotifications()
 {
     var useronline = new AccountController().GetonlineUser_ID();
     var noti = db.Notifications.Where(x => x.receiverID == useronline).OrderByDescending(x=>x.dateIn).ToList();
     return View("~/Views/Users/Notifications.cshtml", noti);
 }
Ejemplo n.º 20
0
 public ActionResult Notifications()
 {
     var useronline = new AccountController().GetonlineUser_ID();
     var noti = db.Notifications.Where(x => x.receiverID == useronline && x.status == false).ToList();
     return View(noti);
 }
Ejemplo n.º 21
0
 public ActionResult TopicBookmark(Guid topicid)
 {
     var userid = new AccountController().GetonlineUser_ID();
     var existbookmark = db.TopicBookMarks.Where(x => x.topicID == topicid && x.userID == userid).FirstOrDefault();
     if (existbookmark == null)
     {
         TopicBookMark tbm = new TopicBookMark();
         tbm.userID = userid;
         tbm.topicID = topicid;
         db.TopicBookMarks.Add(tbm);
         db.SaveChanges();
         return Json(true, JsonRequestBehavior.AllowGet);
     }
     else
     {
         db.TopicBookMarks.Remove(existbookmark);
         db.SaveChanges();
         return Json("Exist", JsonRequestBehavior.AllowGet);
     }
 }
Ejemplo n.º 22
0
 public ActionResult UserTopics()
 {
     var userid = new AccountController().GetonlineUser_ID();
     ViewBag.usertopic = db.Topics.Where(x => x.UserID == userid).ToList();
     return View();
 }
Ejemplo n.º 23
0
        public ActionResult QuestionBookmark(Guid questionID)
        {
            var userid = new AccountController().GetonlineUser_ID();
            var existBookmark = db.QuestionBookMarks.Where(x => x.userID == userid && x.questionID == questionID).FirstOrDefault();
            if (existBookmark == null)
            {
                QuestionBookMark qbm = new QuestionBookMark();
                qbm.questionID = questionID;
                qbm.userID = userid;
                db.QuestionBookMarks.Add(qbm);
                db.SaveChanges();
                return Json(true, JsonRequestBehavior.AllowGet);
            }
            else
            {
                db.QuestionBookMarks.Remove(existBookmark);
                db.SaveChanges();
                return Json("Exist", JsonRequestBehavior.AllowGet);
            }


        }
Ejemplo n.º 24
0
 public ActionResult ManageUserGroup(int groupID)
 {
     var userID = new AccountController().GetonlineUser_ID();
     var userInGroup = db.UserInGroups.Where(x => x.GroupID == groupID && x.Status == true && x.UserID != userID).ToList();
     return View(userInGroup);
 }
Ejemplo n.º 25
0
        public ActionResult RequestForGroup(int groupID)
        {
            var userID = new AccountController().GetonlineUser_ID();
            var isExist = db.UserInGroups.Where(x => x.UserID == userID && x.GroupID == groupID).FirstOrDefault();
            if (isExist != null)
            {
                return Json("beforsent", JsonRequestBehavior.AllowGet);
            }
            else
            {
                try
                {
                    var reqGroup = new UserInGroup();
                    reqGroup.GroupID = groupID;
                    reqGroup.ID = Guid.NewGuid();
                    reqGroup.UserID = userID;
                    reqGroup.DateIn = DateTime.Now;
                    reqGroup.isAdminUser = false;
                    db.UserInGroups.Add(reqGroup);
                    var noti = new Notification();
                    noti.dateIn = DateTime.Now;
                    noti.ID = Guid.NewGuid();
                    var gp = db.Groups.Find(groupID);
                    noti.receiverID = gp.UserID;
                    noti.senderID = userID;
                    noti.status = false;
                    noti.title = "درخواست عضویت برای گروه";
                    noti.text = "یک کاربر برای گروه " + gp.GroupSubject + " در خواست عضویت داده است لطفا به قسمت لیست درخواست گروه های خود بروید";
                    db.Notifications.Add(noti);
                    db.SaveChanges();
                    return Json(true, JsonRequestBehavior.AllowGet);
                }
                catch
                {
                    return Json("beforsent", JsonRequestBehavior.AllowGet);
                }
            }


        }
Ejemplo n.º 26
0
 public ActionResult UserTopic(int? page, string SuccessMessage)
 {
     if (!string.IsNullOrEmpty(SuccessMessage))
         ViewBag.SuccessMessage = SuccessMessage;
     var id = new AccountController().GetonlineUser_ID();
     page = page ?? 1;
     int PageSize = 5;
     int Offset = (((page ?? 1) - 1) * PageSize) + 1;
     var TopicR = db.Topics.Where(x => x.UserID == id && x.status == PostStatus.Active).OrderByDescending(x => x.DateIn).Skip(Offset).Take(PageSize).ToList();
     int TotalTopics = db.Topics.Where(x => x.UserID == id && x.status == PostStatus.Active).Count();
     var TopicsPage = new StaticPagedList<Topic>(TopicR, page ?? 1 + 1, PageSize, TotalTopics);
     ViewBag.Topics = TopicR;
     ViewBag.TopicPage = TopicsPage;
     return View(TopicR);
 }
Ejemplo n.º 27
0
 public ActionResult UserQuestion(int? page, string SuccessMessage)
 {
     if (!string.IsNullOrEmpty(SuccessMessage))
         ViewBag.SuccessMessage = SuccessMessage;
     var id = new AccountController().GetonlineUser_ID();
     page = page ?? 1;
     int PageSize = 5;
     int Offset = (((page ?? 1) - 1) * PageSize) + 1;
     var questionR = db.Questions.Where(x => x.userID == id && x.status == PostStatus.Active).OrderByDescending(x => x.createDate).Skip(Offset).Take(PageSize).ToList();
     int TotalQuestion = db.Questions.Where(x => x.userID == id && x.status == PostStatus.Active).Count();
     var questionPage = new StaticPagedList<Question>(questionR, page ?? 1 + 1, PageSize, TotalQuestion);
     ViewBag.Question = questionR;
     ViewBag.QuestionPage = questionPage;
     return View(questionR);
 }
Ejemplo n.º 28
0
        public ActionResult UserQuestions()
        {
            var userid = new AccountController().GetonlineUser_ID();
            ViewBag.UserQuestions = db.Questions.Where(x => x.userID == userid).ToList();
            return View();

        }
Ejemplo n.º 29
0
        public ActionResult Create(MembershipOfSite membershipofsite, HttpPostedFileBase pictureFile, string confirmPassword, string password, string securityQuestion, string answerSecurityQuestion)
        {
            if (ModelState.IsValid)
            {
                //if (!Roles.RoleExists("Bronze"))
                //    Roles.CreateRole("Bronze");
                AccountController ac = new AccountController();
                string Result = ac.CreateAccount(membershipofsite.Username, password,
                    membershipofsite.Email, securityQuestion, answerSecurityQuestion);
                if (Result != "Success")
                {
                    ModelState.AddModelError("", Result);
                    ViewBag.SQ = securityQuestion;
                    ViewBag.ASQ = answerSecurityQuestion;
                    ViewBag.SecurityQuestion = new SelectList(db.SecurityQuestions, "QuestionText", "QuestionText", securityQuestion);
                    return View(membershipofsite);
                }
                else
                {
                    if (!Roles.RoleExists("Admin"))
                        Roles.CreateRole("Admin");
                    Roles.AddUserToRole(membershipofsite.Username, "Admin");
                    membershipofsite.ID = Guid.NewGuid();
                    membershipofsite.DateSignUp = DateTime.Now;
                    var gradeforreg = db.Assistances.Select(x => x.GradeForReister).FirstOrDefault();
                    if (gradeforreg != null)
                    {
                        membershipofsite.Grade += Convert.ToInt32(gradeforreg);
                    }
                    if (pictureFile != null)
                    {
                        string fileName = Guid.NewGuid().ToString() + System.IO.Path.GetExtension(pictureFile.FileName);
                        WebImage WI = new WebImage(pictureFile.InputStream);
                        WI.Resize(200, 200, false, false);
                        WI.Save(Server.MapPath("~/Files/UsersImage/" + fileName));
                        membershipofsite.Picture = fileName;
                    }
                    db.MembershipOfSites.Add(membershipofsite);
                    db.SaveChanges();
                    if (Roles.IsUserInRole("Admin"))
                        return RedirectToAction("Index");
                    else
                    {
                        ac.LogIn(new LoginViewModel() { Password = password, UserName = membershipofsite.Username, RememberMe = false }, null);

                        return RedirectToAction("Index", "home");
                    }
                }
            }
            ViewBag.SecurityQuestion = new SelectList(db.SecurityQuestions, "QuestionText", "QuestionText", securityQuestion);
            return View(membershipofsite);
        }
Ejemplo n.º 30
0
 public ActionResult YourOwnGroup()
 {
     var userid = new AccountController().GetonlineUser_ID();
     var useringroup = db.UserInGroups.Where(x => x.UserID == userid && x.Status == true).ToList();
     ViewBag.useringroup = useringroup.ToList();
     return View(useringroup);
 }