예제 #1
0
        public IHttpActionResult PostEnroll([FromBody] CoursesOfStudent cos)
        {
            string Name = Thread.CurrentPrincipal.Identity.Name;

            int     subid = cos.CourseId;
            Subject ss    = subRepo.GetSubDetaileById(subid);

            ss.StudentCount += 1;
            subRepo.Edit(ss);

            cos.TeacherId = ss.TeacherId;
            cosRepo.Insert(cos);

            Registration reg = new Registration();

            reg.SubjectId   = cos.CourseId;
            reg.StudentName = Name;
            reg.Fee         = ss.Price;
            regRepo.Insert(reg);

            return(Ok(cos));
        }