public ActionResult Students_group_load(SVM.Students_group_load model, int page = 1, char action = '0', int row = -1, int id_students_group_load = -1)
        {
            switch (action)
            {
                case 'a':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = new SVM.Students_group_load();
                    break;

                case 's':
                    if (ModelState.IsValid)
                    {
                        if (DB.Students_group_load.Count(sgl => sgl.id_students_group == model.id_students_group && sgl.id_subject == model.id_subject) > 0)
                        {
                            ViewBag.action = 'a';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Students_group_load_duplicate_group_and_subject_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Students_group_load.Add(model);
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Students_group_load_add_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'a';
                        ViewBag.row = row;
                    }
                    break;

                case 'e':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = DB.Students_group_load.Find(id_students_group_load);
                    break;

                case 'u':
                    if (ModelState.IsValid)
                    {
                        if (DB.Students_group_load.Count(sgl => sgl.id_students_group == model.id_students_group && sgl.id_subject == model.id_subject && sgl.id_students_group_load != model.id_students_group_load) > 0)
                        {
                            ViewBag.action = 'e';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Students_group_load_duplicate_group_and_subject_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Students_group_load.Find(id_students_group_load).hours = model.hours;
                                DB.Students_group_load.Find(id_students_group_load).id_students_group = model.id_students_group;
                                DB.Students_group_load.Find(id_students_group_load).id_subject = model.id_subject;
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Students_group_load_edit_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'e';
                        ViewBag.row = row;
                    }
                    break;

                case 'r':
                    ModelState.Clear();
                    model = DB.Students_group_load.Find(id_students_group_load);
                    if (DB.Students_group_load.Count(sgl => sgl.id_students_group == model.id_students_group && sgl.id_subject == model.id_subject) > 0)
                    {
                        try
                        {
                            DB.Students_group_load.Remove(DB.Students_group_load.Find(id_students_group_load));
                            DB.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            ModelState.AddModelError("-4", Localizator.Localizate("Students_group_load_delete_error", CurrentLangCode));
                            if (HttpContext.IsDebuggingEnabled)
                                ModelState.AddModelError("-4", ex.GetBaseException().Message);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("-5", Localizator.Localizate("Students_group_load_existance_error", CurrentLangCode));
                    }
                    break;

                default:
                    ModelState.Clear();

                    ViewBag.action = '0';
                    ViewBag.row = -1;
                    break;
            }

            try
            {
                IQueryable<SVM.Students_group_load> Istudents_group_loads;

                int elements_on_page = Int32.Parse(ConfigurationManager.AppSettings["ElementsOnPage"]);
                if (DB.Students_group_load.Count() <= elements_on_page)
                {
                    ViewBag.pages = 1;
                    Istudents_group_loads = DB.Students_group_load;
                }
                else
                {
                    int pages = (DB.Students_group_load.Count() / elements_on_page) + 1;

                    ViewBag.elements_on_page = elements_on_page;
                    ViewBag.page = page;
                    ViewBag.pages = pages;

                    if (page == 1)
                        Istudents_group_loads = DB.Students_group_load.Take(elements_on_page);
                    else
                    {
                        if (page == pages)
                            Istudents_group_loads = DB.Students_group_load.OrderBy(t => t.id_students_group_load).Skip(elements_on_page * (page - 1));
                        else
                            Istudents_group_loads = DB.Students_group_load.OrderBy(t => t.id_students_group_load).Skip(elements_on_page * (page - 1)).Take(elements_on_page);
                    }
                }

                ViewBag.students_group_loads = Istudents_group_loads.ToList();
                ViewBag.students_groups = DB.Students_group.ToList();
                ViewBag.subjects = DB.Subject.ToList();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("-1", Localizator.Localizate("Students_group_load_view_error", CurrentLangCode));
                if (HttpContext.IsDebuggingEnabled)
                    ModelState.AddModelError("-1", ex.GetBaseException().Message);
            }

            return View(model);
        }
        public ActionResult Students_group(SVM.Students_group model, int page = 1, char action = '0', int row = -1, int id_students_group = -1)
        {
            switch (action)
            {
                case 'a':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = new SVM.Students_group();
                    break;

                case 's':
                    if (ModelState.IsValid)
                    {

                        if (DB.Students_group.Count(sg => sg.name == model.name) > 0)
                        {
                            ViewBag.action = 'a';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Students_group_duplicate_number_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Students_group.Add(model);
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Students_group_add_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'a';
                        ViewBag.row = row;
                    }
                    break;

                case 'e':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = DB.Students_group.Find(id_students_group);
                    break;

                case 'u':
                    if (ModelState.IsValid)
                    {
                        if (DB.Students_group.Count(sg => sg.name == model.name && sg.id_students_group != model.id_students_group) > 0)
                        {
                            ViewBag.action = 'e';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Students_group_duplicate_number_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Students_group.Find(id_students_group).name = model.name;
                                DB.Students_group.Find(id_students_group).people_amount = model.people_amount;
                                DB.Students_group.Find(id_students_group).id_department = model.id_department;
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Students_group_edit_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'e';
                        ViewBag.row = row;
                    }
                    break;

                case 'r':
                    ModelState.Clear();
                    model = DB.Students_group.Find(id_students_group);
                    if (DB.Students_group.Count(sg => sg.name == model.name) > 0)
                    {
                        try
                        {
                            DB.Students_group.Remove(DB.Students_group.Find(id_students_group));
                            DB.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            ModelState.AddModelError("-4", Localizator.Localizate("Students_group_delete_error", CurrentLangCode));
                            if (HttpContext.IsDebuggingEnabled)
                                ModelState.AddModelError("-4", ex.GetBaseException().Message);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("-5", Localizator.Localizate("Students_group_existance_error", CurrentLangCode));
                    }
                    break;

                default:
                    ModelState.Clear();

                    ViewBag.action = '0';
                    ViewBag.row = -1;
                    break;
            }

            try
            {
                IQueryable<SVM.Students_group> Istudents_groups;

                int elements_on_page = Int32.Parse(ConfigurationManager.AppSettings["ElementsOnPage"]);
                if (DB.Students_group.Count() <= elements_on_page)
                {
                    ViewBag.pages = 1;
                    Istudents_groups = DB.Students_group;
                }
                else
                {
                    int pages = (DB.Students_group.Count() / elements_on_page) + 1;

                    ViewBag.elements_on_page = elements_on_page;
                    ViewBag.page = page;
                    ViewBag.pages = pages;

                    if (page == 1)
                        Istudents_groups = DB.Students_group.Take(elements_on_page);
                    else
                    {
                        if (page == pages)
                            Istudents_groups = DB.Students_group.OrderBy(sg => sg.id_students_group).Skip(elements_on_page * (page - 1));
                        else
                            Istudents_groups = DB.Students_group.OrderBy(sg => sg.id_students_group).Skip(elements_on_page * (page - 1)).Take(elements_on_page);
                    }
                }

                ViewBag.students_groups = Istudents_groups.ToList();
                ViewBag.departments = DB.Department.ToList();
                ViewBag.faculties = GetSafeFaculties().ToList();

            }
            catch (Exception ex)
            {
                ModelState.AddModelError("-1", Localizator.Localizate("Students_group_view_error", CurrentLangCode));
                if (HttpContext.IsDebuggingEnabled)
                    ModelState.AddModelError("-1", ex.GetBaseException().Message);
            }

            return View(model);
        }
        public ActionResult Teacher(SVM.Teacher model, int page = 1, char action = '0', int row = -1, int id_teacher = -1)
        {
            switch (action)
            {
                case 'a':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = new SVM.Teacher();
                    break;

                case 's':
                    if (ModelState.IsValid)
                    {
                        if (DB.Teacher.Count(t => t.surname == model.surname && t.name == model.name && t.patronymic == model.patronymic) > 0)
                        {
                            ViewBag.action = 'a';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Teacher_duplicate_surname_and_name_and_patronymic_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Teacher.Add(model);
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Teacher_add_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'a';
                        ViewBag.row = row;
                    }
                    break;

                case 'e':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = DB.Teacher.Find(id_teacher);
                    break;

                case 'u':
                    if (ModelState.IsValid)
                    {
                        if (DB.Teacher.Count(t => t.surname == model.surname && t.name == model.name && t.patronymic == model.patronymic && t.id_teacher != model.id_teacher) > 0)
                        {
                            ViewBag.action = 'e';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Teacher_duplicate_surname_and_name_and_patronymic_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Teacher.Find(id_teacher).surname = model.surname;
                                DB.Teacher.Find(id_teacher).name = model.name;
                                DB.Teacher.Find(id_teacher).patronymic = model.patronymic;
                                DB.Teacher.Find(id_teacher).working_position = model.working_position;
                                DB.Teacher.Find(id_teacher).regalia = model.regalia;
                                DB.Teacher.Find(id_teacher).id_department = model.id_department;
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Teacher_edit_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'e';
                        ViewBag.row = row;
                    }
                    break;

                case 'r':
                    ModelState.Clear();
                    model = DB.Teacher.Find(id_teacher);
                    if (DB.Teacher.Count(t => t.surname == model.surname && t.name == model.name && t.patronymic == model.patronymic) > 0)
                    {
                        try
                        {
                            DB.Teacher.Remove(DB.Teacher.Find(id_teacher));
                            DB.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            ModelState.AddModelError("-4", Localizator.Localizate("Teacher_delete_error", CurrentLangCode));
                            if (HttpContext.IsDebuggingEnabled)
                                ModelState.AddModelError("-4", ex.GetBaseException().Message);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("-5", Localizator.Localizate("Teacher_existance_error", CurrentLangCode));
                    }
                    break;

                default:
                    ModelState.Clear();

                    ViewBag.action = '0';
                    ViewBag.row = -1;
                    break;
            }

            try
            {
                IQueryable<SVM.Teacher> Iteachers;

                int elements_on_page = Int32.Parse(ConfigurationManager.AppSettings["ElementsOnPage"]);
                if (DB.Teacher.Count() <= elements_on_page)
                {
                    ViewBag.pages = 1;
                    Iteachers = DB.Teacher;
                }
                else
                {
                    int pages = (DB.Teacher.Count() / elements_on_page) + 1;

                    ViewBag.elements_on_page = elements_on_page;
                    ViewBag.page = page;
                    ViewBag.pages = pages;

                    if (page == 1)
                        Iteachers = DB.Teacher.Take(elements_on_page);
                    else
                    {
                        if (page == pages)
                            Iteachers = DB.Teacher.OrderBy(t => t.id_teacher).Skip(elements_on_page * (page - 1));
                        else
                            Iteachers = DB.Teacher.OrderBy(t => t.id_teacher).Skip(elements_on_page * (page - 1)).Take(elements_on_page);
                    }
                }

                ViewBag.teachers = Iteachers.ToList();
                ViewBag.departments = DB.Department.ToList();
                ViewBag.faculties = DB.Faculty.ToList();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("-1", Localizator.Localizate("Teacher_view_error", CurrentLangCode));
                if (HttpContext.IsDebuggingEnabled)
                    ModelState.AddModelError("-1", ex.GetBaseException().Message);
            }

            return View(model);
        }
        public ActionResult Faculty(SVM.Faculty model, int page = 1, char action = '0', int row = -1, int id_faculty = -1)
        {
            switch (action)
            {
                case 'a':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = new SVM.Faculty();
                    break;

                case 's':
                    if (ModelState.IsValid)
                    {
                        if (DB.Faculty.Count(f => f.name == model.name || f.abbreviation == model.abbreviation) > 0)
                        {
                            ViewBag.action = 'a';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Faculty_duplicate_name_or_abbreviation_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Faculty.Add(model);
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Faculty_add_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'a';
                        ViewBag.row = row;
                    }
                    break;

                case 'e':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = DB.Faculty.Find(id_faculty);
                    break;

                case 'u':
                    if (ModelState.IsValid)
                    {
                        if (DB.Faculty.Count(f => (f.name == model.name || f.abbreviation == model.abbreviation) && f.id_faculty != model.id_faculty) > 0)
                        {
                            ViewBag.action = 'e';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Faculty_duplicate_name_or_abbreviation_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Faculty.Find(id_faculty).name = model.name;
                                DB.Faculty.Find(id_faculty).abbreviation = model.abbreviation;
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Faculty_edit_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'e';
                        ViewBag.row = row;
                    }
                    break;

                case 'r':
                    ModelState.Clear();
                    model = DB.Faculty.Find(id_faculty);
                    if (DB.Faculty.Count(f => f.name == model.name || f.abbreviation == model.abbreviation) > 0)
                    {
                        try
                        {
                            DB.Faculty.Remove(DB.Faculty.Find(id_faculty));
                            DB.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            ModelState.AddModelError("-4", Localizator.Localizate("Faculty_delete_error", CurrentLangCode));
                            if (HttpContext.IsDebuggingEnabled)
                                ModelState.AddModelError("-4", ex.GetBaseException().Message);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("-5", Localizator.Localizate("Faculty_existance_error", CurrentLangCode));
                    }
                    break;

                default:
                    ModelState.Clear();

                    ViewBag.action = '0';
                    ViewBag.row = -1;
                    break;
            }

            try
            {
                IQueryable<SVM.Faculty> Ifaculies;

                int elements_on_page = Int32.Parse(ConfigurationManager.AppSettings["ElementsOnPage"]);
                if (DB.Faculty.Count() <= elements_on_page)
                {
                    ViewBag.pages = 1;
                    Ifaculies = DB.Faculty;
                }
                else
                {
                    int pages = (DB.Faculty.Count() / elements_on_page) + 1;

                    ViewBag.elements_on_page = elements_on_page;
                    ViewBag.page = page;
                    ViewBag.pages = pages;

                    if (page == 1)
                        Ifaculies = DB.Faculty.Take(elements_on_page);
                    else
                    {
                        if (page == pages)
                            Ifaculies = DB.Faculty.OrderBy(f => f.id_faculty).Skip(elements_on_page * (page - 1));
                        else
                            Ifaculies = DB.Faculty.OrderBy(f => f.id_faculty).Skip(elements_on_page * (page - 1)).Take(elements_on_page);
                    }
                }

                ViewBag.faculties = Ifaculies.ToList();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("-1", Localizator.Localizate("Faculty_view_error", CurrentLangCode));
                if (HttpContext.IsDebuggingEnabled)
                    ModelState.AddModelError("-1", ex.GetBaseException().Message);
            }

            return View(model);
        }
        public ActionResult Classroom(SVM.Classroom model, int page = 1, char action = '0', int row = -1, int id_classroom = -1)
        {
            switch (action)
            {
                case 'a':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = new SVM.Classroom();
                    break;

                case 's':
                    if (ModelState.IsValid)
                    {
                        if (DB.Classroom.Count(c => c.number == model.number) > 0)
                        {
                            ViewBag.action = 'a';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Classroom_duplicate_number_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Classroom.Add(model);
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Classroom_add_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'a';
                        ViewBag.row = row;
                    }
                    break;

                case 'e':
                    ModelState.Clear();

                    ViewBag.action = action;
                    ViewBag.row = row;

                    model = DB.Classroom.Find(id_classroom);
                    break;

                case 'u':
                    if (ModelState.IsValid)
                    {
                        if (DB.Classroom.Count(c => c.number == model.number && c.id_classroom != model.id_classroom) > 0)
                        {
                            ViewBag.action = 'e';
                            ViewBag.row = row;

                            ModelState.AddModelError("-2", Localizator.Localizate("Classroom_duplicate_number_error", CurrentLangCode));
                        }
                        else
                        {
                            ViewBag.action = '0';
                            ViewBag.row = -1;

                            try
                            {
                                DB.Classroom.Find(id_classroom).number = model.number;
                                DB.Classroom.Find(id_classroom).people_capacity = model.people_capacity;
                                DB.Classroom.Find(id_classroom).id_department = model.id_department;
                                DB.SaveChanges();
                            }
                            catch (Exception ex)
                            {
                                ModelState.AddModelError("-3", Localizator.Localizate("Classroom_edit_error", CurrentLangCode));
                                if (HttpContext.IsDebuggingEnabled)
                                    ModelState.AddModelError("-3", ex.GetBaseException().Message);
                            }
                        }
                    }
                    else
                    {
                        ViewBag.action = 'e';
                        ViewBag.row = row;
                    }
                    break;

                case 'r':
                    ModelState.Clear();
                    model = DB.Classroom.Find(id_classroom);
                    if (DB.Classroom.Count(c => c.number == model.number) > 0)
                    {
                        try
                        {
                            DB.Classroom.Remove(DB.Classroom.Find(id_classroom));
                            DB.SaveChanges();
                        }
                        catch (Exception ex)
                        {
                            ModelState.AddModelError("-4", Localizator.Localizate("Classroom_delete_error", CurrentLangCode));
                            if (HttpContext.IsDebuggingEnabled)
                                ModelState.AddModelError("-4", ex.GetBaseException().Message);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("-5", Localizator.Localizate("Classroom_existance_error", CurrentLangCode));
                    }
                    break;

                default:
                    ModelState.Clear();

                    ViewBag.action = '0';
                    ViewBag.row = -1;
                    break;
            }

            try
            {
                IQueryable<SVM.Classroom> Iclassrooms;

                int elements_on_page = Int32.Parse(ConfigurationManager.AppSettings["ElementsOnPage"]);
                if (DB.Classroom.Count() <= elements_on_page)
                {
                    ViewBag.pages = 1;
                    Iclassrooms = DB.Classroom;
                }
                else
                {
                    int pages = (DB.Classroom.Count() / elements_on_page) + 1;

                    ViewBag.elements_on_page = elements_on_page;
                    ViewBag.page = page;
                    ViewBag.pages = pages;

                    if (page == 1)
                        Iclassrooms = DB.Classroom.Take(elements_on_page);
                    else
                    {
                        if (page == pages)
                            Iclassrooms = DB.Classroom.OrderBy(c => c.id_classroom).Skip(elements_on_page * (page - 1));
                        else
                            Iclassrooms = DB.Classroom.OrderBy(c => c.id_classroom).Skip(elements_on_page * (page - 1)).Take(elements_on_page);
                    }
                }

                ViewBag.classrooms = Iclassrooms.ToList();
                ViewBag.departments = DB.Department.ToList();
                ViewBag.faculties = DB.Faculty.ToList();
            }
            catch (Exception ex)
            {
                ModelState.AddModelError("-1", Localizator.Localizate("Classroom_view_error", CurrentLangCode));
                if (HttpContext.IsDebuggingEnabled)
                    ModelState.AddModelError("-1", ex.GetBaseException().Message);
            }

            return View(model);
        }