public ActionResult BatchAction(int?id)
        {
            ViewBag.drpTutor  = CommonController.drpTutor();
            ViewBag.drpLesson = CommonController.drpLesson();

            if (id != 0)
            {
                Lessonbatch dataset = entities.Lessonbatches.Find(id);
                return(PartialView(dataset));
            }

            else
            {
                return(PartialView());
            }
        }
        public ActionResult BatchAction(Lessonbatch lesson)
        {
            ModelState.Remove("LessonBatchID");

            if (ModelState.IsValid)
            {
                string msg = "";

                if (lesson.LessonBatchID > 0)
                {
                    var dataset = entities.Lessonbatches.Where(f => f.LessonBatchID == lesson.LessonBatchID).FirstOrDefault();
                    if (dataset != null)
                    {
                        dataset.Name        = lesson.Name;
                        dataset.Duration    = lesson.Duration;
                        dataset.StartTime   = lesson.StartTime;
                        dataset.EndTime     = lesson.EndTime;
                        dataset.Description = lesson.Description;
                        dataset.LessonID    = lesson.LessonID;
                        dataset.TutorID     = lesson.TutorID;
                        dataset.BatchDate   = lesson.BatchDate;
                        msg = "Lesson Batch Updated Successfully";
                    }
                }
                else
                {
                    entities.Lessonbatches.Add(lesson);
                    msg = "New Lesson Batch Added successfully";
                }
                entities.SaveChanges();
                return(new JsonResult
                {
                    Data = new
                    {
                        success = true,
                        action = "Batch",
                        message = msg
                    },
                    JsonRequestBehavior = JsonRequestBehavior.AllowGet
                });
            }
            ViewBag.drpTutor  = CommonController.drpTutor();
            ViewBag.drpLesson = CommonController.drpLesson();
            return(PartialView(lesson));
        }