public async Task <IActionResult> PutQueryedustudyinperiod(int id, Queryedustudyinperiod queryedustudyinperiod)
        {
            if (id != queryedustudyinperiod.Id)
            {
                return(BadRequest());
            }

            _context.Entry(queryedustudyinperiod).State = EntityState.Modified;

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

            return(Ok(queryedustudyinperiod));
        }
        public async Task <IActionResult> PostQueryedustudyinperiod(Queryedustudyinperiod queryedustudyinperiod)
        {
            _context.queryedustudyinperiods.Add(queryedustudyinperiod);
            await _context.SaveChangesAsync();

            return(Ok(queryedustudyinperiod));
        }
        public async Task <IActionResult> Get(Queryedustudyinperiod queryedustudyinperiod = null)
        {
            var result = _context.queryedustudyinperiods.AsQueryable();

            if (queryedustudyinperiod != null)
            {
                if (queryedustudyinperiod.SchoolArea.HasValue)
                {
                    result = result.Where(a => a.SchoolArea == queryedustudyinperiod.SchoolArea);
                }
                if (queryedustudyinperiod.BuildingCode.HasValue)
                {
                    result = result.Where(a => a.BuildingCode == queryedustudyinperiod.BuildingCode);
                }
                if (!string.IsNullOrEmpty(queryedustudyinperiod.BuildingOwnership))
                {
                    result = result.Where(a => a.BuildingOwnership == queryedustudyinperiod.BuildingOwnership);
                }
                if (queryedustudyinperiod.ClassroomNumber.HasValue)
                {
                    result = result.Where(a => a.ClassroomNumber == queryedustudyinperiod.ClassroomNumber);
                }
                if (!string.IsNullOrEmpty(queryedustudyinperiod.LandPieceCode))
                {
                    result = result.Where(a => a.LandPieceCode == queryedustudyinperiod.LandPieceCode);
                }
                if (queryedustudyinperiod.StudentsNumber.HasValue)
                {
                    result = result.Where(a => a.StudentsNumber == queryedustudyinperiod.StudentsNumber);
                }
                if (!string.IsNullOrEmpty(queryedustudyinperiod.PeriodNumber))
                {
                    result = result.Where(a => a.PeriodNumber == queryedustudyinperiod.PeriodNumber);
                }
                if (!string.IsNullOrEmpty(queryedustudyinperiod.LandOwnership))
                {
                    result = result.Where(a => a.LandOwnership == queryedustudyinperiod.LandOwnership);
                }
                if (queryedustudyinperiod.StudyDate != null)
                {
                    result = result.Where(a => a.StudyDate == queryedustudyinperiod.StudyDate);
                }
            }


            if (result == null)
            {
                return(NotFound());
            }

            return(Ok(await result.ToListAsync()));
        }