// Create Lectures
        public int createLecture(lectureModel lectureData, bool feed, DateTime endDate)
        {
            int result = 0;

            using (myProjectEntities context = new myProjectEntities())
            {
                lectureData.lecture_status = 1;

                Mapper.CreateMap <lectureModel, tblLecture>();
                tblLecture newLec = Mapper.Map <lectureModel, tblLecture>(lectureData);

                context.tblLectures.Add(newLec);
                int qq = context.SaveChanges();
                result = qq;

                if (feed)
                {
                    feedbackModel feedModel = new feedbackModel();
                    feedModel.FK_Lecture_id = newLec.PK_Lecture_id;
                    feedModel.end_date      = endDate;
                    qq = createFeedback(feedModel);
                }
                return(result);
            }
        }
 public feedbackModel GetFeedbackByLectureId(int lectureId)
 {
     using (myProjectEntities context = new myProjectEntities())
     {
         tblFeedback feed = context.tblFeedbacks.Where(q => q.FK_Lecture_id == lectureId).FirstOrDefault();
         Mapper.CreateMap <tblFeedback, feedbackModel>();
         feedbackModel result = Mapper.Map <tblFeedback, feedbackModel>(feed);
         return(result);
     }
 }
        //Create new Feedback
        public int createFeedback(feedbackModel feedData)
        {
            int result = 0;

            using (myProjectEntities context = new myProjectEntities())
            {
                Mapper.CreateMap <feedbackModel, tblFeedback>();

                tblFeedback newFeed = Mapper.Map <feedbackModel, tblFeedback>(feedData);

                context.tblFeedbacks.Add(newFeed);
                int q = context.SaveChanges();
                if (q > 0)
                {
                    result = newFeed.PK_Feedback_id;
                }
                return(result);
            }
        }