// GET: api/lesson
        public IEnumerable <LessonViewModel> Get()
        {
            List <LessonViewModel> list = new List <LessonViewModel>();

            using (ILessonService ls = new LessonService(WebApiApplication.connection))
            {
                list = Mapper.Map <List <LessonViewModel> >(ls.GetAll());
            }
            return(list);
        }
        // GET: Home
        public ActionResult Lesson()
        {
            if (Session["log"] == null)
            {
                return(RedirectToAction("Login", "Home", null));
            }
            var Lessons = LessonService.GetAll().ToList();

            return(View(Lessons));
        }
        public IHttpActionResult GetLessons()
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    return(BadRequest(ModelState));
                }

                var models  = new List <LessonModel>();
                var service = new LessonService();

                return(Ok(BindingManager.ToLessonModels(service.GetAll())));
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

                return(InternalServerError(ex));
            }
        }