Ejemplo n.º 1
0
        public ActionResult Create([Bind(Include = "Id,TeacherID,JoiningDate")] AspNetTeacher aspNetTeacher)
        {
            var TransactionObj = db.Database.BeginTransaction();

            try
            {
                if (ModelState.IsValid)
                {
                    db.AspNetTeachers.Add(aspNetTeacher);
                    db.SaveChanges();
                }
                TransactionObj.Commit();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                var        UserNameLog = User.Identity.Name;
                AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog   = a.Id;

                var logMessage = "New Teacher Added, TeacherID: " + aspNetTeacher.TeacherID + ", JoiningDate: " + aspNetTeacher.JoiningDate;

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


                return(RedirectToAction("Index"));
            }
            catch { TransactionObj.Dispose(); }

            ViewBag.TeacherID = new SelectList(db.AspNetUsers, "Id", "Email", aspNetTeacher.TeacherID);
            return(View(aspNetTeacher));
        }
Ejemplo n.º 2
0
        public ActionResult Create([Bind(Include = "Id,SubjectName,ClassID,TeacherID")] AspNetSubject aspNetSubject)
        {
            var TransactionObj = db.Database.BeginTransaction();

            try
            {
                if (ModelState.IsValid)
                {
                    db.AspNetSubjects.Add(aspNetSubject);
                    db.SaveChanges();
                }
                TransactionObj.Commit();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                var        UserNameLog = User.Identity.Name;
                AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog   = a.Id;
                string     user        = db.AspNetUsers.Where(x => x.Id == aspNetSubject.TeacherID).Select(x => x.Name).FirstOrDefault();
                var        logMessage  = "New Subject Added, SubjectName: " + aspNetSubject.SubjectName + ", ClassID: " + aspNetSubject.ClassID + ", TeacherName: " + user;

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                return(RedirectToAction("ClassIndexs"));
            }
            catch {
                TransactionObj.Dispose();

                ViewBag.ClassID   = new SelectList(db.AspNetClasses, "Id", "ClassName", aspNetSubject.ClassID);
                ViewBag.TeacherID = new SelectList(db.AspNetUsers.Where(x => x.AspNetRoles.Select(y => y.Name).Contains("Teacher")), "Id", "Name");

                return(View("Create", aspNetSubject));
            }
        }
Ejemplo n.º 3
0
        public ActionResult Create([Bind(Include = "Id,SessionName,SessionStartDate,SessionEndDate,Status")] AspNetSession aspNetSession)
        {
            var TransactionObj = db.Database.BeginTransaction();

            if (db.AspNetSessions.Where(x => x.Status == "Active").Count() == 0 || aspNetSession.Status == "InActive")
            {
                if (ModelState.IsValid)
                {
                    aspNetSession.SessionEndDate   = Convert.ToDateTime(Request.Form["SessionEndDate"]);
                    aspNetSession.SessionStartDate = Convert.ToDateTime(Request.Form["SessionStartDate"]);
                    db.AspNetSessions.Add(aspNetSession);
                    db.SaveChanges();
                }
                TransactionObj.Commit();
                ////////////////////////////////////////////////////////Term Add/////////////////////////////////////////////////////////////////
                int length = 3;
                for (int i = 0; i < length; i++)
                {
                    AspNetTerm aspnetTerm = new AspNetTerm();
                    aspnetTerm.SessionID     = aspNetSession.Id;
                    aspnetTerm.TermName      = "Term " + (i + 1);
                    aspnetTerm.TermStartDate = DateTime.Now;
                    aspnetTerm.TermEndDate   = DateTime.Now;
                    aspnetTerm.Status        = "InActive";
                    db.AspNetTerms.Add(aspnetTerm);
                    db.SaveChanges();
                }

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                var        UserNameLog = User.Identity.Name;
                AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog   = a.Id;
                var        logMessage  = "New Session Added, SessionName: " + aspNetSession.SessionName + ", SessionStartDate: " + aspNetSession.SessionStartDate + ", SessionEndDate: " + aspNetSession.SessionEndDate + ", Status: " + aspNetSession.Status;

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


                return(RedirectToAction("Indexs"));
            }
            else
            {
                return(RedirectToAction("Index"));
            }
        }
        public ActionResult Create([Bind(Include = "Id,ClassName,Class,Section,TeacherID")] AspNetClass aspNetClass)
        {
            aspNetClass.SessionID = SessionID;
            var transactionObj = db.Database.BeginTransaction();

            try
            {
                if (ModelState.IsValid)
                {
                    db.AspNetClasses.Add(aspNetClass);
                    db.SaveChanges();
                }
                transactionObj.Commit();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                var        UserNameLog         = User.Identity.Name;
                AspNetUser userObjLog          = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog           = userObjLog.Id;
                AspNetUser ClassTeacherLog     = db.AspNetUsers.First(x => x.Id == aspNetClass.TeacherID);
                string     ClassTeacherNameLog = ClassTeacherLog.Name;
                string     user       = db.AspNetUsers.Where(x => x.Id == aspNetClass.TeacherID).Select(x => x.Name).FirstOrDefault();
                var        logMessage = "A new Class Added, Name: " + aspNetClass.ClassName + ", Class Teacher: " + ClassTeacherNameLog + ", Teacher Name: " + user;

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                return(RedirectToAction("Index"));
            }
            catch (Exception)
            {
                transactionObj.Dispose();
            }

            ViewBag.Class     = new SelectList(Classes, "option", "value");
            ViewBag.Section   = new SelectList(Sections, "option", "value");
            ViewBag.TeacherID = new SelectList(db.AspNetUsers.Where(x => x.AspNetRoles.Select(y => y.Name).Contains("Teacher")), "Id", "UserName", aspNetClass.TeacherID);
            return(View(aspNetClass));
        }
Ejemplo n.º 5
0
        public ActionResult Create([Bind(Include = "Id,TermName,SessionID,TermStartDate,TermEndDate,Status")] AspNetTerm aspNetTerm)
        {
            var TransactionObj = db.Database.BeginTransaction();

            try
            {
                if (ModelState.IsValid)
                {
                    var terms = db.AspNetTerms.Where(p => p.SessionID == aspNetTerm.SessionID).Count();
                    aspNetTerm.TermNo = terms + 1;

                    db.AspNetTerms.Add(aspNetTerm);
                    db.SaveChanges();
                }
                TransactionObj.Commit();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                var        UserNameLog = User.Identity.Name;
                AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog   = a.Id;

                var logMessage = "New Term Added, TermName: " + aspNetTerm.TermName + ", TermStartDate: " + aspNetTerm.TermStartDate + ", TermEndDate: " + aspNetTerm.TermEndDate + ", Status: " + aspNetTerm.Status;

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


                return(RedirectToAction("Indexs"));
            }
            catch
            {
                TransactionObj.Dispose();
            }

            ViewBag.SessionID = new SelectList(db.AspNetSessions, "Id", "SessionName", aspNetTerm.SessionID);
            return(RedirectToAction("Index"));
        }
        public ActionResult Create([Bind(Include = "Id,TopicNo,TopicName,StartDate,EndDate,ChapterID,Status")] AspNetTopic aspNetTopic)
        {
            var dbTransaction = db.Database.BeginTransaction();

            try
            {
                if (ModelState.IsValid)
                {
                    db.AspNetTopics.Add(aspNetTopic);
                    db.SaveChanges();
                }
                dbTransaction.Commit();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                var        UserNameLog = User.Identity.Name;
                AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog   = a.Id;
                var        logMessage  = "New Topic Added, SubjectID: " + aspNetTopic.ChapterID + ", Topic: " + aspNetTopic.TopicName;

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);

                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                ViewBag.CreateTopic = "Topic created and updated successfully";
                ViewBag.ClassID     = new SelectList(db.AspNetSubjects.Where(x => x.TeacherID == TeacherID).Select(x => x.AspNetClass).Distinct(), "Id", "ClassName");
                return(View("../Teacher_Dashboard/_Topics"));
            }
            catch (Exception)
            {
                dbTransaction.Dispose();
                ViewBag.ChapterID = new SelectList(db.AspNetChapters.Where(x => x.AspNetSubject.AspNetClass.SessionID == SessionID), "Id", "ChapterName", aspNetTopic.ChapterID);
                return(View(aspNetTopic));
            }

            ViewBag.ChapterID = new SelectList(db.AspNetChapters.Where(x => x.AspNetSubject.AspNetClass.SessionID == SessionID), "Id", "ChapterName", aspNetTopic.ChapterID);
            return(View(aspNetTopic));
        }
        public ActionResult Create([Bind(Include = "Id,SubjectName,ClassID,TeacherID")] AspNetSubject aspNetSubject)
        {
            var CourseType = Convert.ToString(Request.Form["CourseType"]);
            var class_id   = db.AspNetClasses.Where(x => x.SessionID == SessionID).FirstOrDefault().Id;

            aspNetSubject.ClassID    = class_id;
            aspNetSubject.CourseType = Request.Form["CourseType"];
            string IsMandatory = Request.Form["IsMandatory"];

            aspNetSubject.Points = Int32.Parse(Request.Form["Points"]);


            if (IsMandatory == "on")
            {
                aspNetSubject.IsManadatory = true;
            }
            else
            {
                aspNetSubject.IsManadatory = false;

                if (CourseType == "CSS")
                {
                    aspNetSubject.SubjectGroup = Convert.ToString(Request.Form["CSSGroup"]);
                }
                else
                {
                    aspNetSubject.SubjectGroup = Convert.ToString(Request.Form["PMSGroup"]);
                }
            }


            var TransactionObj = db.Database.BeginTransaction();

            try
            {
                if (ModelState.IsValid)
                {
                    db.AspNetSubjects.Add(aspNetSubject);
                    db.SaveChanges();
                }
                TransactionObj.Commit();
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                var        UserNameLog = User.Identity.Name;
                AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                string     UserIDLog   = a.Id;
                string     user        = db.AspNetUsers.Where(x => x.Id == aspNetSubject.TeacherID).Select(x => x.Name).FirstOrDefault();
                var        logMessage  = "New Subject Added, SubjectName: " + aspNetSubject.SubjectName + ", ClassID: " + aspNetSubject.ClassID + ", TeacherName: " + user;

                //string[] SelectedTeachers = Request.Form["TotalTeachers"].Split(',');

                //    var class_id = db.AspNetClasses.Where(x => x.SessionID == SessionID).FirstOrDefault().Id;
                //  var sub_id = db.AspNetSubjects.Where(x => x.SubjectName == aspNetSubject.SubjectName && x.ClassID == class_id).FirstOrDefault().Id;

                var teacherid = db.AspNetEmployees.Where(x => x.UserId == aspNetSubject.TeacherID).FirstOrDefault().Id;


                //var SelectedTeahcersFromDB = db.AspNetEmployees.Where(x=> SelectedTeachers.Contains(x.UserId)).ToList();


                //foreach(var Emplyee in SelectedTeahcersFromDB)
                //{

                // assign subject to teacher start

                /*
                 * AspNetTeacherSubject ts = new AspNetTeacherSubject();
                 *
                 *
                 * ts.TeacherID = teacherid;
                 * ts.SubjectID = aspNetSubject.Id;
                 * db.AspNetTeacherSubjects.Add(ts);
                 * db.SaveChanges();
                 */

                // assign subject to teachers end //

                //}

                var LogControllerObj = new AspNetLogsController();
                LogControllerObj.CreateLogSave(logMessage, UserIDLog);
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                return(RedirectToAction("ClassIndexs"));
            }
            catch
            {
                TransactionObj.Dispose();

                ViewBag.ClassID   = new SelectList(db.AspNetClasses, "Id", "ClassName", aspNetSubject.ClassID);
                ViewBag.TeacherID = new SelectList(db.AspNetUsers.Where(x => x.AspNetRoles.Select(y => y.Name).Contains("Teacher")), "Id", "Name");

                return(View("Create", aspNetSubject));
            }
        }
Ejemplo n.º 8
0
        public ActionResult Create([Bind(Include = "Id,Title,Description")] AspNetAnnouncement aspNetAnnouncement)
        {
            string subjects = Request.Form["subjects"];
            IEnumerable <string> selectedsubjects = subjects.Split(',');

            if (ModelState.IsValid)
            {
                var dbContextTransaction = db.Database.BeginTransaction();
                try
                {
                    aspNetAnnouncement.Date = DateTime.Now;
                    db.AspNetAnnouncements.Add(aspNetAnnouncement);
                    db.SaveChanges();
                    int        announcementID = db.AspNetAnnouncements.Max(item => item.Id);
                    List <int> SubjectIDs     = new List <int>();
                    foreach (var item in selectedsubjects)
                    {
                        int subjectID = Convert.ToInt32(item);
                        SubjectIDs.Add(subjectID);
                    }
                    foreach (var item in SubjectIDs)
                    {
                        AspNetAnnouncement_Subject ann_sub = new AspNetAnnouncement_Subject();
                        ann_sub.SubjectID      = item;
                        ann_sub.AnnouncementID = announcementID;
                        db.AspNetAnnouncement_Subject.Add(ann_sub);
                        db.SaveChanges();
                    }
                    List <string> student = db.AspNetStudent_Subject.Where(x => SubjectIDs.Contains(x.SubjectID)).Select(s => s.StudentID).ToList();
                    foreach (var item in student)
                    {
                        AspNetStudent_Announcement stu_ann = new AspNetStudent_Announcement();
                        stu_ann.StudentID      = item;
                        stu_ann.AnnouncementID = announcementID;
                        stu_ann.Seen           = false;
                        db.AspNetStudent_Announcement.Add(stu_ann);
                        db.SaveChanges();
                        /////////////////////////////////////////////////////Push Notifications Module////////////////////////////////////////////////////////////

                        //var pushNotificationObj = new AspNetPushNotification();
                        //pushNotificationObj.Message = "New Announcement: " + aspNetAnnouncement.Title + ", Description: " + aspNetAnnouncement.Description;
                        //pushNotificationObj.UserID = item;
                        //pushNotificationObj.IsOpenParent = false;
                        //pushNotificationObj.IsOpenStudent = false;
                        //pushNotificationObj.Time = DateTime.Now;
                        //db.AspNetPushNotifications.Add(pushNotificationObj);
                        //db.SaveChanges();
                    }
                    ////////////////////////////////////////////////NOTIFICATION///////////////////////////////////////////////////////////////////


                    var NotificationObj = new AspNetNotification();
                    NotificationObj.Description = aspNetAnnouncement.Description;
                    NotificationObj.Subject     = aspNetAnnouncement.Title;
                    NotificationObj.SenderID    = User.Identity.GetUserId();
                    NotificationObj.Time        = DateTime.Now;
                    NotificationObj.Url         = "/AspNetAnnouncement/details/" + aspNetAnnouncement.Id;
                    NotificationObj.SessionID   = SessionID;
                    db.AspNetNotifications.Add(NotificationObj);
                    db.SaveChanges();

                    var           NotificationID = db.AspNetNotifications.Max(x => x.Id);
                    List <string> students       = db.AspNetStudent_Subject.Where(x => SubjectIDs.Contains(x.SubjectID)).Select(s => s.StudentID).ToList();


                    var users = new List <String>();

                    foreach (var item in students)
                    {
                        var parentID = db.AspNetParent_Child.Where(x => x.ChildID == item).Select(x => x.ParentID).FirstOrDefault();
                        users.Add(parentID);
                    }

                    var allusers = users.Union(students);

                    //Message start
                    //var classe = db.AspNetClasses.Where(p => p.Id == aspNetHomework.ClassId).FirstOrDefault();
                    //Utility obj = new Utility();
                    //obj.SMSToOffitialsp("Dear Principal, Announcement has been made with Title: " + aspNetAnnouncement.Title + "- IPC NGS Preschool, Aziz Avenue, Lahore.");
                    //obj.SMSToOffitialsa("Dear Admin, Announcement has been made with Title: " + aspNetAnnouncement.Title + "- IPC NGS Preschool, Aziz Avenue, Lahore.");
                    //AspNetMessage oob = new AspNetMessage();
                    //oob.Message = "Dear Parents, Announcement has been made with Title: " + aspNetAnnouncement.Title + "For discription login to Portal please  - IPC NGS Preschool, Aziz Avenue, Lahore.";
                    //obj.SendSMS(oob, users);
                    //Message end

                    foreach (var receiver in allusers)
                    {
                        var notificationRecieve = new AspNetNotification_User();
                        notificationRecieve.NotificationID = NotificationID;
                        notificationRecieve.UserID         = Convert.ToString(receiver);
                        notificationRecieve.Seen           = false;
                        db.AspNetNotification_User.Add(notificationRecieve);
                        db.SaveChanges();
                    }

                    dbContextTransaction.Commit();
                    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

                    var        UserNameLog = User.Identity.Name;
                    AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
                    string     UserIDLog   = a.Id;
                    var        classObjLog = Request.Form["ClassID"];
                    var        logMessage  = "A new Announcement Added, Topic: " + aspNetAnnouncement.Title + ", Description: " + aspNetAnnouncement.Description + ", ClassIDs: " + classObjLog;

                    var LogControllerObj = new AspNetLogsController();
                    LogControllerObj.CreateLogSave(logMessage, UserIDLog);

                    /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                }
                catch (Exception)
                {
                    dbContextTransaction.Dispose();
                }

                return(RedirectToAction("Teacher_Announcement", "Teacher_Dashboard"));
            }

            return(View(aspNetAnnouncement));
        }
        public ActionResult Create([Bind(Include = "Id,SessionName,SessionStartDate,SessionEndDate,Status,Total_Fee")] AspNetSession aspNetSession)
        {
            var TransactionObj = db.Database.BeginTransaction();

            if (ModelState.IsValid)
            {
                aspNetSession.SessionEndDate   = Convert.ToDateTime(Request.Form["SessionEndDate"]);
                aspNetSession.SessionStartDate = Convert.ToDateTime(Request.Form["SessionStartDate"]);
                aspNetSession.Total_Fee        = aspNetSession.Total_Fee;
                db.AspNetSessions.Add(aspNetSession);
                db.SaveChanges();
            }


            TransactionObj.Commit();
            ////////////////////////////////////////////////////////Term Add/////////////////////////////////////////////////////////////////
            //int length = 3;
            //for (int i = 0; i < length; i++)
            //{
            //    AspNetTerm aspnetTerm = new AspNetTerm();
            //    aspnetTerm.SessionID = aspNetSession.Id;
            //    aspnetTerm.TermName = "Term " + (i + 1);
            //    aspnetTerm.TermStartDate = DateTime.Now;
            //    aspnetTerm.TermEndDate = DateTime.Now;
            //    aspnetTerm.Status = "InActive";
            //    db.AspNetTerms.Add(aspnetTerm);
            //    db.SaveChanges();
            //}

            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            var        UserNameLog = User.Identity.Name;
            AspNetUser a           = db.AspNetUsers.First(x => x.UserName == UserNameLog);
            string     UserIDLog   = a.Id;
            var        logMessage  = "New Session Added, SessionName: " + aspNetSession.SessionName + ", SessionStartDate: " + aspNetSession.SessionStartDate + ", SessionEndDate: " + aspNetSession.SessionEndDate + ", Status: " + aspNetSession.Status;

            var LogControllerObj = new AspNetLogsController();

            LogControllerObj.CreateLogSave(logMessage, UserIDLog);
            /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

            AspNetClass Class = new AspNetClass();

            var CurrentSession = db.AspNetSessions.OrderByDescending(x => x.Id).FirstOrDefault();

            Class.ClassName = CurrentSession.SessionName;

            Class.Class     = CurrentSession.SessionName;
            Class.SessionID = CurrentSession.Id;
            db.AspNetClasses.Add(Class);
            db.SaveChanges();

            //Create Subjects to New Session

            var AllSubjectsofTestSession = db.AspNetSubjects.Where(x => x.ClassID == 1).ToList();

            List <subjects_mapping> list = new List <subjects_mapping>();

            foreach (AspNetSubject Subject in AllSubjectsofTestSession)
            {
                subjects_mapping sub = new subjects_mapping();
                sub.oldId = Subject.Id;
                sub.name  = Subject.SubjectName;

                AspNetSubject NewSubjectForSession = new AspNetSubject();

                NewSubjectForSession = Subject;

                NewSubjectForSession.ClassID   = Class.Id;
                NewSubjectForSession.TeacherID = null;

                db.AspNetSubjects.Add(NewSubjectForSession);
                db.SaveChanges();

                sub.newId = NewSubjectForSession.Id;

                list.Add(sub);
            }


            var AllTeacherSubjects = db.AspNetTeacherSubjects.Where(x => x.AspNetSubject.ClassID == 1).ToList();

            foreach (var item in AllTeacherSubjects)
            {
                foreach (var item1 in list)
                {
                    if (item1.oldId == item.SubjectID)
                    {
                        AspNetTeacherSubject TS = new AspNetTeacherSubject();
                        TS.SubjectID = item1.newId;
                        TS.TeacherID = item.TeacherID;
                        db.AspNetTeacherSubjects.Add(TS);
                        break;
                    }
                }
            }

            db.SaveChanges();


            var UserIDs = (from teacher in db.AspNetUsers.Where(x => x.Status != "False")
                           join t2 in db.AspNetUsers_Session
                           on teacher.Id equals t2.UserID
                           join t3 in db.AspNetEmployees
                           on teacher.Id equals t3.UserId
                           where teacher.AspNetRoles.Select(y => y.Name).Contains("Teacher") && t2.AspNetSession.AspNetClasses.Any(x => x.Id == 1) /*&& db.AspNetChapters.Any(x=>x.Id==id)*/
                           select new
            {
                TeacherId = teacher.Id,
                EmployeeId = t3.Id,
            }).ToList();

            foreach (var Id in UserIDs)
            {
                string IdString = Id.TeacherId.ToString();

                AspNetUsers_Session UserSession = new AspNetUsers_Session();

                UserSession.SessionID = aspNetSession.Id;
                UserSession.UserID    = IdString;

                db.AspNetUsers_Session.Add(UserSession);
                db.SaveChanges();
            }


            foreach (var Id in UserIDs)
            {
                Aspnet_Employee_Session EmployeeSession = new Aspnet_Employee_Session();


                EmployeeSession.Emp_Id     = Id.EmployeeId;
                EmployeeSession.Session_Id = aspNetSession.Id;

                db.Aspnet_Employee_Session.Add(EmployeeSession);
                db.SaveChanges();
            }

            return(RedirectToAction("Indexs"));
        }