public async Task <IActionResult> Add(DAL.Lesson lesson)
        {
            await _lesson.AddLesson(lesson);

            await AddLog(lesson.NAME + " adlı ders eklendi.");

            return(RedirectToAction("Add", new { success = true }));
        }
        public async Task <IActionResult> Edit(DAL.Lesson lesson)
        {
            await _lesson.EditLesson(lesson);

            await AddLog(lesson.NAME + " adlı ders güncellendi.");

            return(RedirectToAction("Edit", new { id = lesson.LESSONID, success = true }));
        }
Beispiel #3
0
        public DAL.Lesson GetLesson(DAL.Lesson lesson)
        {
            var query      = "SELECT TOP 1 * FROM LESSON WHERE LESSONID=@LESSONID";
            var parameters = new
            {
                LESSONID = lesson.LESSONID
            };

            return(_connection.GetConnection().Query <DAL.Lesson>(query, parameters).SingleOrDefault());
        }
Beispiel #4
0
        public async Task DeleteLesson(DAL.Lesson lesson)
        {
            var query      = "DELETE FROM LESSON WHERE LESSONID=@LESSONID";
            var parameters = new
            {
                LESSONID = lesson.LESSONID
            };

            await Execute(query, parameters);
        }
Beispiel #5
0
        public async Task AddLesson(DAL.Lesson lesson)
        {
            var query      = "INSERT INTO LESSON(CLASSID,CODE,NAME,SORT,STATUS) VALUES(@CLASSID,@CODE,@NAME,@SORT,@STATUS)";
            var parameters = new
            {
                CLASSID = lesson.CLASSID,
                CODE    = lesson.CODE,
                NAME    = lesson.NAME,
                SORT    = lesson.SORT,
                STATUS  = lesson.STATUS
            };

            await Execute(query, parameters);
        }
Beispiel #6
0
        public async Task EditLesson(DAL.Lesson lesson)
        {
            var query      = "UPDATE LESSON SET CLASSID=@CLASSID,CODE=@CODE,NAME=@NAME,SORT=@SORT,STATUS=@STATUS WHERE LESSONID=@LESSONID";
            var parameters = new
            {
                CLASSID  = lesson.CLASSID,
                CODE     = lesson.CODE,
                NAME     = lesson.NAME,
                SORT     = lesson.SORT,
                STATUS   = lesson.STATUS,
                LESSONID = lesson.LESSONID
            };

            await Execute(query, parameters);
        }
        public async Task <IActionResult> Delete()
        {
            if (!string.IsNullOrEmpty(RouteData.Values["id"].ToString()))
            {
                var id     = int.Parse(RouteData.Values["id"].ToString());
                var lesson = new DAL.Lesson
                {
                    LESSONID = id
                };
                await _lesson.DeleteLesson(lesson);

                await AddLog(id + " numaralı ders silindi.");
            }
            return(RedirectToAction("Index"));
        }
        public IActionResult Edit()
        {
            var data = new DAL.Lesson
            {
                LESSONID = int.Parse(RouteData.Values["id"].ToString())
            };

            var lessonItem = _lesson.GetLesson(data);

            if (!string.IsNullOrEmpty(Request.Query["success"]))
            {
                ViewData["alert"] = "swal('Ders Düzenle', 'Ders düzenlendi.', 'success');";
            }

            ViewData["Classes"] = _class.GetClasses();
            return(View(lessonItem));
        }