public async Task <IActionResult> PutStudentdatainschoolstudy(int id, Studentdatainschoolstudy studentdatainschoolstudy) { if (id != studentdatainschoolstudy.Id) { return(BadRequest()); } _context.Entry(studentdatainschoolstudy).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StudentdatainschoolstudyExists(id)) { return(NotFound()); } else { throw; } } return(Ok(studentdatainschoolstudy)); }
public async Task <IActionResult> PostStudentdatainschoolstudy(Studentdatainschoolstudy studentdatainschoolstudy) { _context.studentdatainschoolstudies.Add(studentdatainschoolstudy); await _context.SaveChangesAsync(); return(Ok(studentdatainschoolstudy)); }
public async Task <IActionResult> Get(Studentdatainschoolstudy studentdatainschoolstudy = null) { var result = _context.studentdatainschoolstudies.AsQueryable(); if (studentdatainschoolstudy != null) { if (studentdatainschoolstudy.BuildingCode.HasValue) { result = result.Where(a => a.BuildingCode == studentdatainschoolstudy.BuildingCode); } if (studentdatainschoolstudy.LandPieceCode.HasValue) { result = result.Where(a => a.LandPieceCode == studentdatainschoolstudy.LandPieceCode); } if (!string.IsNullOrEmpty(studentdatainschoolstudy.StudentsNumber)) { result = result.Where(a => a.StudentsNumber == studentdatainschoolstudy.StudentsNumber); } if (!string.IsNullOrEmpty(studentdatainschoolstudy.PeriodName)) { result = result.Where(a => a.PeriodName == studentdatainschoolstudy.PeriodName); } if (!string.IsNullOrEmpty(studentdatainschoolstudy.PeriodNumber)) { result = result.Where(a => a.PeriodNumber == studentdatainschoolstudy.PeriodNumber); } if (studentdatainschoolstudy.StudyDate != null) { result = result.Where(a => a.StudyDate == studentdatainschoolstudy.StudyDate); } } if (result == null) { return(NotFound()); } return(Ok(await result.ToListAsync())); }