예제 #1
0
 public CourseSessionController()
 {
     _courseBs           = new CourseBs();
     _courseSessionBs    = new CourseSessionBs();
     _courseSessionModel = new CourseSessionModel();
     apiResponse         = new APIResponseModel();
 }
예제 #2
0
 public CourseBs()
 {
     _tbl_Course            = new GenericPattern <Course>();
     _CourseModel           = new CourseModel();
     _CourseTestAnswerModel = new CourseTestAnswerModel();
     _CourseTestModel       = new CourseTestModel();
     _CourseSessionModel    = new CourseSessionModel();
 }
예제 #3
0
 public CourseController()
 {
     _courseModel        = new CourseModel();
     _courseBs           = new CourseBs();
     _courseSessionModel = new CourseSessionModel();
     _courseSessionBs    = new CourseSessionBs();
     _courseTestBs       = new CourseTestBs();
     _courseTestModel    = new CourseTestModel();
 }
예제 #4
0
 public CourseSession(CourseSessionModel item)
 {
     Id        = item.Id;
     Topic     = item.Topic;
     CourseID  = item.CourseID;
     Document1 = item.Document1;
     Document2 = item.Document2;
     CreatedOn = item.CreatedOn;
     CreatedBy = item.CreatedBy;
     VideoLink = item.VideoLink;
     AudioLink = item.AudioLink;
 }
예제 #5
0
        public ActionResult SessionCreate(long?id)
        {
            if (id != null)
            {
                var Varial = _courseSessionBs.GetById(Convert.ToInt32(id));
                return(View(Varial));
            }
            CourseSessionModel model = new CourseSessionModel();

            if (TempData["CourseID"] != null)
            {
                model.CourseID = Convert.ToInt64(TempData["CourseID"]);
            }

            return(View(model));
        }
예제 #6
0
        public long Save(CourseSessionModel model)
        {
            CourseSession _tbl_courseSession = new CourseSession(model);

            if (model.Id != null && model.Id != 0)
            {
                _CourseSession.Update(_tbl_courseSession);
            }
            else
            {
                _tbl_courseSession.CreatedOn = System.DateTime.Now;
                _CourseSession.Insert(_tbl_courseSession);
            }

            return(_tbl_courseSession.Id);
        }
예제 #7
0
        public CourseSessionModel GetById(long id)
        {
            var res = _CourseSession.GetById(Convert.ToInt32(id));

            CourseSessionModel obj = new CourseSessionModel();

            obj.Id        = res.Id;
            obj.Topic     = res.Topic;
            obj.CourseID  = res.CourseID;
            obj.Document1 = res.Document1;
            obj.Document2 = res.Document2;
            obj.AudioLink = res.AudioLink;
            obj.VideoLink = res.VideoLink;
            obj.CreatedOn = res.CreatedOn;
            obj.CreatedBy = res.CreatedBy;
            //}).FirstOrDefault();

            return(obj);
        }
예제 #8
0
        public IHttpActionResult GetCourseSession(Int64 topicID)
        {
            CourseSessionModel model = new CourseSessionModel();
            var sessionData          = _courseSessionBs.GetById(topicID);

            if (sessionData == null)
            {
                apiResponse.IsSuccess = false;
                apiResponse.Message   = "No Session Found";
            }
            model.Topic     = sessionData.Topic;
            model.VideoLink = sessionData.VideoLink;
            model.AudioLink = sessionData.AudioLink;
            model.Document1 = sessionData.Document1 != null ? ConfigurationManager.AppSettings["BaseUrl"] + "/Documents" + "/" + sessionData.Document1 : string.Empty;
            model.Document2 = sessionData.Document2 != null ? ConfigurationManager.AppSettings["BaseUrl"] + "/Documents" + "/" + sessionData.Document2 : string.Empty;
            model.CourseID  = sessionData.CourseID;
            model.Id        = sessionData.Id;


            apiResponse.IsSuccess = true;
            apiResponse.Data      = model;
            return(Ok(apiResponse));
        }
예제 #9
0
        public ActionResult SessionCreate(FormCollection form, List <HttpPostedFileBase> Document)
        {
            List <CourseSessionModel> model = new List <CourseSessionModel>();

            var keys = form.AllKeys.Where(x => x.StartsWith("Topic")).ToList();

            var obj = new CourseSessionModel();

            foreach (var item in keys)
            {
                var currentKeyNum = item.Replace("Topic", "");
                obj.Id        = Convert.ToInt64(form["Id"]);
                obj.CourseID  = Convert.ToInt64(form["CourseID"]);
                obj.Topic     = form["Topic" + currentKeyNum];
                obj.AudioLink = form["AudioLink" + currentKeyNum];
                obj.VideoLink = form["VideoLink" + currentKeyNum];
                obj.Document1 = form["Doc1" + currentKeyNum];
                obj.Document2 = form["Doc2" + currentKeyNum];
                obj.CreatedBy = new UserRegistrationBs().UserRegistrationList().Where(x => x.UserName == User.Identity.Name).FirstOrDefault().Id;
                obj.CreatedOn = System.DateTime.Now;
                //if (Document[0] == null ? false : Document[0].ContentLength > 0)
                //{
                //    var ext = Path.GetExtension(Document[0].FileName);
                //    Random number = new Random();
                //    obj.Document1 = "Document_" + number.Next(1000000000) + ext;
                //    string path = Server.MapPath("~/Documents/" + obj.Document1);
                //    Document[0].SaveAs(path);
                //    // save image

                //}
                //if (Document[1] == null ? false : Document[1].ContentLength > 0)
                //{
                //    var ext1 = Path.GetExtension(Document[1].FileName);
                //    Random number1 = new Random();
                //    obj.Document2 = "Document_" + number1.Next(1000000000) + ext1;
                //    string path1 = Server.MapPath("~/Documents/" + obj.Document2);
                //    Document[1].SaveAs(path1);

                //}

                //for (int i = 0; i < 2; i++)
                //{
                //    Document.Remove(Document[0]);
                //}


                //obj.Document1 = form["FirstDocument" + currentKeyNum];
                // obj.Document2 = form["SecondDocument" + currentKeyNum];

                _courseSessionBs.Save(obj);
            }


            //long i = 0;

            //if (model != null)
            //{
            //    i = _courseSessionBs.Save(model);
            //}

            //if (i > 0)
            //{
            //    TempData["msg"] = "Save Successfully";
            //}
            //else
            //{
            //    TempData["msg"] = "Error while saving data";
            //}

            return(RedirectToAction("Sessions", "Course", new { area = "Admin", id = obj.CourseID }));
        }
예제 #10
0
 public CourseSessionModel GetCourseSession(CourseSessionModel model)
 {
     throw new NotImplementedException();
 }