public async Task <IActionResult> PutPracticalCourse(int id, [FromForm] PracticalCourse practicalCourse)
        {
            if (id != practicalCourse.id)
            {
                return(BadRequest());
            }

            practicalCourse.updated_at            = DateTime.Now;
            _context.Entry(practicalCourse).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PracticalCourseExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <ActionResult <PracticalCourse> > PostPracticalCourse([FromForm] PracticalCourseRequest practicalCourse)
        {
            var identity = User.Identity as System.Security.Claims.ClaimsIdentity;
            IEnumerable <System.Security.Claims.Claim> claims = identity.Claims;
            var national_code = claims.Where(p => p.Type == "national_code").FirstOrDefault()?.Value;

            var applicant = _context.applicants.Where(q => q.national_code == national_code).FirstOrDefault();

            if (applicant == null)
            {
                return(Unauthorized());
            }


            var course = new PracticalCourse
            {
                teacher_id     = practicalCourse.teacher_id,
                applicant_id   = applicant.id,
                start_date     = DateTime.Now,
                license_type   = "پایه ۳",
                total_sessions = 10
            };

            _context.practical_courses.Add(course);

            await _context.SaveChangesAsync();

            var schedule = new SchedulePracticalCourse
            {
                schedule_id         = practicalCourse.schedule_id,
                practical_course_id = course.id
            };

            _context.schedule_practical_courses.Add(schedule);

            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPracticalCourse", new { id = course.id }, course));
        }