コード例 #1
0
ファイル: HomeController.cs プロジェクト: vladusha2423/MyRuz
        public IActionResult ListLessons()
        {
            string emailTemp = HttpContext.Request.Cookies["email"];
            string dateTemp  = HttpContext.Request.Cookies["date"];

            ViewData["date"] = GettingDate.MondayDate(dateTemp);
            List <Lesson> deleted = _context.Lessons.Where(l => l.Status == "Delete").ToList(), lessons = new List <Lesson>();

            lessons = Mapper.Mapper.LessonRuzToLesson(_timetable.GetLessons(DateTime.Parse(GettingDate.MondayDate(dateTemp)), DateTime.Parse(GettingDate.MondayDate(dateTemp)).AddDays(6), emailTemp).Result);
            return(View(List.EditList(lessons, deleted, emailTemp)));
        }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: vladusha2423/MyRuz
        public IActionResult Timetable(string email, string date)
        {
            string emailTemp = HttpContext.Request.Cookies["email"];
            string dateTemp  = HttpContext.Request.Cookies["date"];

            if (email != null)
            {
                HttpContext.Response.Cookies.Append("email", email);
            }
            if (date != null)
            {
                date = GettingDate.MondayDate(date, dateTemp);
                HttpContext.Response.Cookies.Append("date", date);
            }
            List <Lesson> deleted = _context.Lessons.Where(l => l.Status == "Delete").ToList(), lessonsUse = new List <Lesson>(), lessons = new List <Lesson>();

            lessons           = Mapper.Mapper.LessonRuzToLesson(_timetable.GetLessons(DateTime.Parse(GettingDate.MondayDate(date, dateTemp)), DateTime.Parse(GettingDate.MondayDate(date, dateTemp)).AddDays(6), Email.GettingEmail(email, emailTemp)).Result);
            ViewData["date"]  = GettingDate.MondayDate(date, dateTemp);
            ViewData["email"] = Email.GettingEmail(email, emailTemp);
            lessonsUse        = List.EditList(lessons, deleted, Email.GettingEmail(email, emailTemp));
            lessonsUse.AddRange(_context.Lessons.Where(l => l.Status == "Add"));
            return(View(lessonsUse));
        }
コード例 #3
0
ファイル: HomeController.cs プロジェクト: vladusha2423/MyRuz
        public IActionResult Update(string name, string date, string beginLesson, string status, string email, int num, int id = 0)
        {
            ViewData["Date"]  = date;
            ViewData["Num"]   = num;
            ViewData["Email"] = email;
            if (status == "Add")
            {
                var lesson = _context.Lessons.Find(id);
                if (lesson != null)
                {
                    _context.Lessons.Remove(lesson);
                    _context.SaveChanges();
                    return(View(lesson));
                }
            }
            List <Lesson> Lessons = Mapper.Mapper.LessonRuzToLesson(_timetable.GetLessons(DateTime.Parse(GettingDate.MondayDate(date)), DateTime.Parse(GettingDate.MondayDate(date)).AddDays(6), email).Result);

            foreach (var i in Lessons)
            {
                if (name == i.Name && beginLesson == i.BeginLesson && date == i.Date)
                {
                    _context.Lessons.Add(new Lesson
                    {
                        Name        = name,
                        Date        = date,
                        Email       = email,
                        BeginLesson = beginLesson,
                        Status      = "Delete"
                    });
                    _context.SaveChanges();
                    Console.WriteLine();
                    return(View(i));
                }
            }
            return(View());
        }
コード例 #4
0
ファイル: HomeController.cs プロジェクト: vladusha2423/MyRuz
 public IActionResult PreviousWeek()
 {
     HttpContext.Response.Cookies.Append("date", DateTime.Parse(GettingDate.MondayDate(HttpContext.Request.Cookies["date"])).AddDays(-7).ToString("d"));
     return(RedirectToAction("Timetable"));
 }