コード例 #1
0
ファイル: TopicController.cs プロジェクト: samuelylchong/FYP
        public ActionResult Create(TopicViewModel topicVM)
        {
            db.Topics.Add(topicVM.Topic);
            db.SaveChanges();

            return(RedirectToAction("Index", "Home", new { area = "" }));
        }
コード例 #2
0
        public ActionResult Create(ExampleViewModel exampleVM)
        {
            db.Examples.Add(exampleVM.Example);
            db.SaveChanges();

            return(RedirectToAction("Index", "Home", new { area = "" }));
        }
コード例 #3
0
        public ActionResult Create(ExerciseViewModel exerciseVM)
        {
            db.Exercises.Add(exerciseVM.Exercise);
            db.SaveChanges();

            return(RedirectToAction("Show", "Example", new { exampleID = exerciseVM.Exercise.ExampleID }));
        }
コード例 #4
0
        public ActionResult Create([Bind(Include = "ID,name")] chart chart)
        {
            if (ModelState.IsValid)
            {
                db.charts.Add(chart);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(chart));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "Vid,Date,VBitcoin,VEthereum,VBitcoinCash,VLitecoin,VRipple")] VoteFinal voteFinal)
        {
            if (ModelState.IsValid)
            {
                db.VoteFinals.Add(voteFinal);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(voteFinal));
        }
コード例 #6
0
        public ActionResult LoginWithFB(string firstName, string lastName, string email)
        {
            user user = new user();

            user.firstName = firstName;
            user.lastName  = lastName;
            user.email     = email;

            List <user> users = db.users.Where(u => u.email == email).ToList();

            if (users.Count == 0)
            {
                user userIn = new user
                {
                    firstName = user.firstName,
                    lastName  = user.lastName,
                    email     = user.email,
                    passwword = null,
                    userType  = "General user"
                };

                // Add the new object to the Orders collection.
                db.users.Add(userIn);

                // Submit the change to the database.
                try
                {
                    db.SaveChanges();
                    Session["isFBAuthenticated"] = true;
                    Session["user"] = user;
                    //return RedirectToAction("Home", "Task");
                    return(Json(new { result = "Redirect", url = Url.Action("Home", "Task") }));
                }
                catch (Exception e)
                {
                    Session["isFBAuthenticated"] = false;
                    Session["user"] = null;
                    Console.WriteLine(e);
                    ModelState.AddModelError("", "Errors while creating your account. Try again..");
                    return(Json(new { result = "Error", url = Url.Action("Login", "Authentication") }));
                }
            }
            else
            {
                Session["user"] = users.FirstOrDefault();
                Session["isFBAuthenticated"] = true;
                //return RedirectToAction("Home", "Task");

                return(Json(new { result = "Redirect", url = Url.Action("Home", "Task") }));
            }
        }
コード例 #7
0
        // deleting rows action
        public ActionResult Delete(string[] ids)
        {
            // delete selected rows
            int[] id = null;
            if (ids != null)
            {
                id = new int[ids.Length];
                int j = 0;
                foreach (string i in ids)
                {
                    int.TryParse(i, out id[j++]);
                }
            }

            if (id != null && id.Length > 0)
            {
                List <VoteFinal> allSelected = new List <VoteFinal>();
                FYPEntities      db          = new FYPEntities();
                allSelected = db.VoteFinals.Where(x => id.Contains(x.Vid)).ToList();
                foreach (var i in allSelected)
                {
                    db.VoteFinals.Remove(i);
                }
                db.SaveChanges();
            }
            return(RedirectToAction("List"));
        }
コード例 #8
0
        public static void NotificationAdd(int id)
        {
            FYPEntities db        = new FYPEntities();
            var         grouplist = db.Student_Group.Where(p => p.Group_Id == id).FirstOrDefault();

            for (int i = 0; i < 2; i++)
            {
                notification notif = new notification();
                if (i == 0)
                {
                    notif.N_To = grouplist.Student_1_ID;
                }
                if (i == 1)
                {
                    notif.N_To = grouplist.Student_2_ID;
                }
                notif.Notification_Msg = "Your Request is Accepted By Advisor";
                notif.Isread           = false;

                notif.DateCreated = DateTime.Now;
                notif.is_active   = true;
                FYPEntities dbs = new FYPEntities();
                dbs.notifications.Add(notif);
                dbs.SaveChanges();
            }
        }
コード例 #9
0
        public JsonResult SendRequest(int id)
        {
            int             myuserid  = Convert.ToInt32(Session["userid"].ToString());
            var             std       = db.Users.Where(p => p.Id == myuserid).FirstOrDefault();
            int             mystdntid = Convert.ToInt32(std.Std_Adv_Id);
            Student_Request stdreq    = new Student_Request();

            stdreq.Request_To_Id   = id;
            stdreq.Request_From_Id = mystdntid;
            stdreq.Is_Active       = true;
            stdreq.Date_Created    = DateTime.Now;
            stdreq.Is_Accepted     = false;
            stdreq.Is_Rejected     = false;
            db.Student_Request.Add(stdreq);
            db.SaveChanges();
            return(Json(new { success = true, msg = "Successfully sent" }, JsonRequestBehavior.AllowGet));
        }
コード例 #10
0
        public JsonResult AcceptRequest(int id)
        {
            int mystdid = Convert.ToInt32(Session["StudentId"]);
            var Stdreq  = db.Student_Request.Where(p => p.Request_From_Id == id && p.Request_To_Id == mystdid).FirstOrDefault();

            db.Dispose();
            var std = new Student_Request()
            {
                ID = Stdreq.ID
            };

            db = new FYPEntities();
            db.Student_Request.Attach(std);

            std.Is_Active      = false;
            std.Is_Accepted    = true;
            std.Date_Accepeted = DateTime.Now;
            db.SaveChanges();
            db.Dispose();

            db = new FYPEntities();
            group grp = new group();

            grp.GroupName   = "Group " + Stdreq.Request_From_Id + " --" + Stdreq.Request_To_Id;
            grp.Is_Active   = true;
            grp.DateCreated = DateTime.Now;
            db.groups.Add(grp);
            db.SaveChanges();

            int grpid = grp.Id;

            var stdgrp = new Student_Group();

            stdgrp.Student_1_ID = Stdreq.Request_From_Id;
            stdgrp.Student_2_ID = Stdreq.Request_To_Id;
            stdgrp.Group_Id     = grpid;
            db.Student_Group.Add(stdgrp);
            db.SaveChanges();

            NotificationAdd(id);


            return(Json(new { success = true, msg = "Successfully sent" }, JsonRequestBehavior.AllowGet));
        }
コード例 #11
0
ファイル: UserController.cs プロジェクト: samuelylchong/FYP
        public ActionResult DeleteConfirmed(int id)
        {
            FYPEntities db = new FYPEntities();

            var userDetails = db.Users.Find(id);

            db.Users.Remove(userDetails);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #12
0
 public ActionResult Index([Bind(Include = "Vid,Date,Email,VBitcoin,VEthereum,VBitcoinCash,VLitecoin,VRipple")] VoteFinal vote)
 {
     if (ModelState.IsValid)
     {
         using (FYPEntities db = new FYPEntities())
         {
             db.VoteFinals.Add(vote);
             db.SaveChanges();
             return(RedirectToAction("Index"));
         }
     }
     return(View("Dash", "Dash"));
 }
コード例 #13
0
 public ActionResult AddAnnouncement(Announcement announcement)
 {
     try
     {
         announcement.DateCreated = DateTime.Now;
         announcement.IsActive    = true;
         db.Announcements.Add(announcement);
         db.SaveChanges();
         return(Json(new { success = true, msg = "successful" }, JsonRequestBehavior.AllowGet));
     }
     catch (Exception ex)
     {
         return(Json(new { success = false, msg = "Failed" + ex.Message }, JsonRequestBehavior.AllowGet));
     }
 }
コード例 #14
0
        public static void NotificationAdd(int id)
        {
            notification notif = new notification();

            notif.N_To             = id;
            notif.Notification_Msg = "Request Accepted";
            notif.Isread           = false;

            notif.DateCreated = DateTime.Now;
            notif.is_active   = true;
            FYPEntities db = new FYPEntities();

            db.notifications.Add(notif);
            db.SaveChanges();
        }
コード例 #15
0
ファイル: UserController.cs プロジェクト: samuelylchong/FYP
        public ActionResult AddOrEdit(User userModel)
        {
            using (FYPEntities db = new FYPEntities())
            {
                if (db.Users.Any(x => x.Username == userModel.Username))
                {
                    ViewBag.DuplicationMessage = "User already exist!";
                    return(View("AddOrEdit", userModel));
                }

                db.Users.Add(userModel);
                db.SaveChanges();
            }

            string fromaddr = "*****@*****.**";
            string toaddr   = userModel.Email;//TO ADDRESS HERE
            string password = "******";


            MailMessage msg = new MailMessage();

            msg.Subject = "Account Created";
            msg.From    = new MailAddress(fromaddr);
            msg.Body    = "Username: "******"\nPassword: "******"smtp.gmail.com";
            smtp.Port = 587;
            smtp.UseDefaultCredentials = false;
            smtp.EnableSsl             = true;
            NetworkCredential nc = new NetworkCredential(fromaddr, password);

            smtp.Credentials = nc;
            smtp.Send(msg);

            ModelState.Clear();
            ViewBag.SuccessMessage = "Registration Successful!";
            return(View("AddOrEdit", new User()));
        }
コード例 #16
0
        public JsonResult AcceptstudentRequest(int id)
        {
            int advisorid = Convert.ToInt32(Session["AdvisorId"]);
            var adv       = db.Advisors.Where(p => p.Id == advisorid).FirstOrDefault();
            int slots     = Convert.ToInt32(adv.Advisors_Slot);

            if (slots > 0 && CheckStudentAdvisorGroup(id) == false)
            {
                var stdadvreq = new Student_Advisor_Request()
                {
                    Id = id
                };

                db.Student_Advisor_Request.Attach(stdadvreq);
                stdadvreq.Is_Accepted   = true;
                stdadvreq.Date_Accepted = DateTime.Now;
                stdadvreq.Is_Active     = false;
                db.SaveChanges();
                db.Dispose();

                db = new FYPEntities();
                var advisorslotupdate = new Advisor()
                {
                    Id = advisorid
                };
                db.Advisors.Attach(advisorslotupdate);
                advisorslotupdate.Advisors_Slot = slots - 1;
                db.SaveChanges();

                NotificationAdd(id);
                return(Json(new { msg = "Successfull", success = true }, JsonRequestBehavior.AllowGet));
            }
            else
            {
                return(Json(new { msg = "Unable To Accept 0 Slots Available or Student Already in Group", success = true }, JsonRequestBehavior.AllowGet));
            }
        }
コード例 #17
0
        /**
         * put new chart into the database
         */
        public ActionResult AddNewChartNameVal(List <DimensionTemplate> dimList)
        {
            string        val          = "";
            ChartTemplate sessionModel = (ChartTemplate)Session["dimensionData"];

            chart chartTable = new chart();

            chartTable.name = sessionModel.name;
            db.charts.Add(chartTable);
            db.SaveChanges();


            if (sessionModel.comparison)
            {
                intention tableIntention = new intention();
                tableIntention.chartID    = chartTable.ID;
                tableIntention.intention1 = "Comparison";
                db.intentions.Add(tableIntention);
                db.SaveChanges();
                val += ",comparison added";
            }
            if (sessionModel.composition)
            {
                intention tableIntention = new intention();
                tableIntention.chartID    = chartTable.ID;
                tableIntention.intention1 = "Composition";
                db.intentions.Add(tableIntention);
                db.SaveChanges();
                val += ",composition added";
            }
            if (sessionModel.distribution)
            {
                intention tableIntention = new intention();
                tableIntention.chartID    = chartTable.ID;
                tableIntention.intention1 = "Distribution";
                db.intentions.Add(tableIntention);
                db.SaveChanges();
                val += ",distribution added";
            }
            if (sessionModel.relationship)
            {
                intention tableIntention = new intention();
                tableIntention.chartID    = chartTable.ID;
                tableIntention.intention1 = "Relationship";
                db.intentions.Add(tableIntention);
                db.SaveChanges();
                val += ",relationip added";
            }

            foreach (var item in dimList)
            {
                item.dimensionIndex++;
                chartDimension tableChartDimension = new chartDimension();
                tableChartDimension.chartID        = chartTable.ID;
                tableChartDimension.dimensionIndex = item.dimensionIndex;
                tableChartDimension.isContinuous   = Convert.ToInt32(item.isContineous);
                db.chartDimensions.Add(tableChartDimension);
                db.SaveChanges();

                if (item.isSelected)
                {
                    dimensionCount tableDimensionCount = new dimensionCount();
                    tableDimensionCount.chartID = chartTable.ID;
                    tableDimensionCount.count   = item.dimensionIndex;
                    db.dimensionCounts.Add(tableDimensionCount);
                    db.SaveChanges();
                    val += ",isselected added";
                }

                if (item.cardinalityAny)
                {
                    chartDimensionCardinality tableChartDimensionCardinality = new chartDimensionCardinality();
                    tableChartDimensionCardinality.dimensionID = tableChartDimension.ID;
                    tableChartDimensionCardinality.cardinality = "Any";
                    db.chartDimensionCardinalities.Add(tableChartDimensionCardinality);
                    db.SaveChanges();
                }
                else
                {
                    if (item.cardinalityHigh)
                    {
                        chartDimensionCardinality tableChartDimensionCardinality = new chartDimensionCardinality();
                        tableChartDimensionCardinality.dimensionID = tableChartDimension.ID;
                        tableChartDimensionCardinality.cardinality = "High";
                        db.chartDimensionCardinalities.Add(tableChartDimensionCardinality);
                        db.SaveChanges();
                    }
                    if (item.cardinalityMedium)
                    {
                        chartDimensionCardinality tableChartDimensionCardinality = new chartDimensionCardinality();
                        tableChartDimensionCardinality.dimensionID = tableChartDimension.ID;
                        tableChartDimensionCardinality.cardinality = "Medium";
                        db.chartDimensionCardinalities.Add(tableChartDimensionCardinality);
                        db.SaveChanges();
                    }
                    if (item.cardinalityLow)
                    {
                        chartDimensionCardinality tableChartDimensionCardinality = new chartDimensionCardinality();
                        tableChartDimensionCardinality.dimensionID = tableChartDimension.ID;
                        tableChartDimensionCardinality.cardinality = "Low";
                        db.chartDimensionCardinalities.Add(tableChartDimensionCardinality);
                        db.SaveChanges();
                    }
                }

                if (item.contextLocation)
                {
                    dimensionContext tableDimensionContext = new dimensionContext();
                    tableDimensionContext.dimensionID = tableChartDimension.ID;
                    tableDimensionContext.context     = "Location";
                    db.dimensionContexts.Add(tableDimensionContext);
                    db.SaveChanges();
                }
                if (item.contextNominal)
                {
                    dimensionContext tableDimensionContext = new dimensionContext();
                    tableDimensionContext.dimensionID = tableChartDimension.ID;
                    tableDimensionContext.context     = "Nominal";
                    db.dimensionContexts.Add(tableDimensionContext);
                    db.SaveChanges();
                }
                if (item.contextNumeric)
                {
                    dimensionContext tableDimensionContext = new dimensionContext();
                    tableDimensionContext.dimensionID = tableChartDimension.ID;
                    tableDimensionContext.context     = "Numeric";
                    db.dimensionContexts.Add(tableDimensionContext);
                    db.SaveChanges();
                }
                if (item.contextPercentage)
                {
                    dimensionContext tableDimensionContext = new dimensionContext();
                    tableDimensionContext.dimensionID = tableChartDimension.ID;
                    tableDimensionContext.context     = "Percentage";
                    db.dimensionContexts.Add(tableDimensionContext);
                    db.SaveChanges();
                }
                if (item.contextTimeseries)
                {
                    dimensionContext tableDimensionContext = new dimensionContext();
                    tableDimensionContext.dimensionID = tableChartDimension.ID;
                    tableDimensionContext.context     = "Time series";
                    db.dimensionContexts.Add(tableDimensionContext);
                    db.SaveChanges();
                }
            }



            return(RedirectToAction("ChartList", "Admin"));
        }
コード例 #18
0
        public ActionResult UploadCSV(bool hasHeader, HttpPostedFileBase file)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Login", "Authentication"));
            }
            else
            {
                if (file != null && file.ContentLength > 0)
                {
                    try
                    {
                        CSVFile csv = new CSVFile();
                        //Saving File in server
                        csv.hasHeader = hasHeader;
                        String GUID             = Guid.NewGuid().ToString();
                        var    myUniqueFileName = string.Format(@"{0}.csv", GUID);
                        string path             = Path.Combine(Server.MapPath("~/CSV"), Path.GetFileName(myUniqueFileName));
                        file.SaveAs(path);

                        //Initializing CSV
                        csv.csvFile  = file;
                        csv.filename = file.FileName;
                        csv.GUID     = GUID;

                        int columnCount = 0;
                        using (Stream fileStream = file.InputStream)
                            using (StreamReader sr = new StreamReader(fileStream))
                            {
                                string a = null;
                                // reading csv header
                                a = sr.ReadLine();
                                string[] columns = a.Split(',');
                                columnCount = columns.Length;
                                csv.Data    = new Column[columnCount];
                                for (int i = 0; i < columnCount; i++)
                                {
                                    Column col = new Column();
                                    col.Data     = new List <string>();
                                    col.selected = true;
                                    csv.Data[i]  = col;
                                }
                                int rows = 0;
                                if (hasHeader)
                                {
                                    //creating new columns
                                    for (int i = 0; i < columnCount; i++)
                                    {
                                        csv.Data[i].Heading = columns[i];
                                    }
                                }
                                else
                                {
                                    rows = 1;
                                    if (!columns.Where(c => c.Equals(String.Empty)).Any())
                                    {
                                        for (int i = 0; i < columnCount; i++)
                                        {
                                            csv.Data[i].Data.Add(columns[i]);
                                            csv.Data[i].Heading = "Column " + (i + 1);
                                        }
                                    }
                                    else
                                    { //fatal error
                                    }
                                }
                                //now read rest of the file

                                while ((a = sr.ReadLine()) != null)
                                {
                                    string[] cols = a.Split(',');
                                    if (!cols.Where(c => c.Equals(String.Empty)).Any())
                                    {
                                        for (int i = 0; i < columnCount; i++)
                                        {
                                            csv.Data[i].Data.Add(cols[i]);
                                        }
                                        rows++;
                                    }
                                    else
                                    {
                                    }
                                }
                                csv.rowCount = rows;
                                // numRows - used as loop variable in creating table
                                if (rows > 10)
                                {
                                    ViewBag.numRows = 10;
                                }
                                else
                                {
                                    ViewBag.numRows = rows;
                                }
                                if (rows > 200)
                                {
                                    ViewBag.Message = "Your csv contain large number of rows (This application not provide big data visualizations)"; return(View());
                                }
                            }


                        // saving to database : OriginalDataFile
                        originalDataFile ori_data = new originalDataFile();
                        ori_data.date         = System.DateTime.Now;
                        ori_data.fileLocation = csv.GUID;
                        user temp = (user)Session["user"];
                        ori_data.userID = temp.ID;
                        db.originalDataFiles.Add(ori_data);
                        db.SaveChanges();

                        csv.ID          = ori_data.ID;
                        TempData["csv"] = csv;
                        return(RedirectToAction("showCSV", "Task"));
                    }
                    catch (Exception ex)
                    {
                        ViewBag.Message = "ERROR:" + ex.Message.ToString();
                    }
                }
                else
                {
                    ViewBag.Message = "You have not specified a file.";
                }
                return(View());
            }
        }
コード例 #19
0
        public ActionResult AcceptRequests(int id)
        {
            var user = new User {
                Id = id
            };

            //db.sp_Accept_SignUp(id);
            db.Users.Attach(user);
            try
            {
                user.Is_Active  = true;
                user.Is_Pending = false;
                user.Status     = "Active";
                db.SaveChanges();
                db.Dispose();
                notification notifc = new notification();
                notifc.Notification_Msg = "Your Sign Up Request Is Accepted";
                notifc.N_To             = id;
                // NotificationAdd(id);
            }
            catch (DbEntityValidationException e)
            {
                foreach (var eve in e.EntityValidationErrors)
                {
                    Console.WriteLine("Entity of type \"{0}\" in state \"{1}\" has the following validation errors:",
                                      eve.Entry.Entity.GetType().Name, eve.Entry.State);
                    foreach (var ve in eve.ValidationErrors)
                    {
                        Console.WriteLine("- Property: \"{0}\", Error: \"{1}\"",
                                          ve.PropertyName, ve.ErrorMessage);
                    }
                }
                throw;
            }
            db = new FYPEntities();
            var usr = db.Users.Where(p => p.Id == id).FirstOrDefault();

            if (usr.Is_Student == true)
            {
                //student data update in students table
                int stdid   = Convert.ToInt32(usr.Std_Adv_Id);
                var student = new Student()
                {
                    ID = stdid
                };
                db.Students.Attach(student);
                student.IsPending = false;
                student.IsActive  = true;
                db.SaveChanges();
                //student data update in user in roles table
                var           roles = db.Roles.Where(p => p.Role_Name == "Student").FirstOrDefault();
                User_IN_Roles uir   = new User_IN_Roles();
                uir.Role_Id      = roles.Id;
                uir.User_Id      = id;
                uir.Is_Active    = true;
                uir.Status       = "Active";
                uir.Date_Created = DateTime.Now;
                uir.Created_By   = 1;
                db.User_IN_Roles.Add(uir);
                db.SaveChanges();
            }
            else
            {
                //advisor data update in students table
                int advid   = Convert.ToInt32(usr.Std_Adv_Id);
                var advisor = new Advisor()
                {
                    Id = advid
                };
                db.Advisors.Attach(advisor);
                advisor.IsBlock  = false;
                advisor.IsActive = true;
                db.SaveChanges();
                //student data update in user in roles table
                var           roles = db.Roles.Where(p => p.Role_Name == "Advisor").FirstOrDefault();
                User_IN_Roles uir   = new User_IN_Roles();
                uir.Role_Id      = roles.Id;
                uir.User_Id      = id;
                uir.Is_Active    = true;
                uir.Status       = "Active";
                uir.Date_Created = DateTime.Now;
                uir.Created_By   = 1;
                db.User_IN_Roles.Add(uir);
                db.SaveChanges();
            }


            return(RedirectToAction("AcceptSignUp", "Admin"));
        }
コード例 #20
0
        public JsonResult Register(User_Registration registermodel)
        {
            if (registermodel.Registration_Type == 1)//student
            {
                Student std = new Student();
                std.Student_Name            = registermodel.Name;
                std.Student_Registration_No = registermodel.university_Id;
                std.Student_Email           = registermodel.Student_Email;
                std.Student_Registration_No = registermodel.university_Id;
                std.IsActive    = false;
                std.IsPending   = true;
                std.DateCreated = DateTime.Now;

                db.Students.Add(std);
                db.SaveChanges();
                var id = std.ID;



                User regusr = new User();
                regusr.User_Name     = registermodel.Name;
                regusr.User_Password = registermodel.User_Password;
                regusr.Date_Created  = DateTime.Now;
                regusr.Status        = "Pending";
                regusr.Is_Active     = false;
                regusr.Is_Pending    = true;
                regusr.Is_Block      = false;
                regusr.Email         = registermodel.Student_Email;
                regusr.Is_Student    = true;
                regusr.Is_Advisor    = false;
                regusr.Std_Adv_Id    = Convert.ToInt32(id);

                db.Users.Add(regusr);
                db.SaveChanges();

                return(Json(new { url = "/Account/Login", msg = "Successfully Created Waiting For Approval From Admin", success = true }, JsonRequestBehavior.AllowGet));
            }
            else//advisor
            {
                Advisor adv = new Advisor();
                adv.AdvisorsName           = registermodel.Name;
                adv.Advisor_Description    = "";
                adv.Advisor_Email          = registermodel.Student_Email;
                adv.Advisor_Uni_ID         = registermodel.university_Id;
                adv.Advisor_Requested_Date = DateTime.Now;
                adv.IsBlock       = false;
                adv.IsActive      = false;
                adv.Advisors_Slot = 5;

                db.Advisors.Add(adv);
                db.SaveChanges();
                var id = adv.Id;



                User regusr = new User();
                regusr.User_Name     = registermodel.Name;
                regusr.User_Password = registermodel.User_Password;
                regusr.Date_Created  = DateTime.Now;
                regusr.Status        = "Pending";
                regusr.Is_Active     = false;
                regusr.Is_Pending    = true;
                regusr.Is_Block      = false;
                regusr.Email         = registermodel.Student_Email;
                regusr.Is_Student    = false;
                regusr.Is_Advisor    = true;
                regusr.Std_Adv_Id    = Convert.ToInt32(id);

                db.Users.Add(regusr);
                db.SaveChanges();
                return(Json(new { url = "/Account/Login", msg = "Successfully Created Waiting For Approval From Admin", success = true }, JsonRequestBehavior.AllowGet));
            }
        }