public async Task <bool> Update(HighSchoolBO highSchool) { await context.HighSchool.Where(t => t.Id == highSchool.Id).UpdateFromQueryAsync(t => new HighSchoolDAO { Code = highSchool.Code, Name = highSchool.Name, ProvinceId = highSchool.ProvinceId, Address = highSchool.Address, }); return(true); }
public async Task <HighSchoolBO> Get(long Id) { HighSchoolBO HighSchool = await context.HighSchool.Where(h => h.Id == Id).Select(h => new HighSchoolBO { Id = h.Id, Code = h.Code, Name = h.Name, ProvinceId = h.ProvinceId, ProvinceCode = h.Province.Code, ProvinceName = h.Province.Name, Address = h.Address, }).FirstOrDefaultAsync(); return(HighSchool); }
public async Task <bool> Create(HighSchoolBO highSchool) { HighSchoolDAO HighSchoolDAO = new HighSchoolDAO { Id = highSchool.Id, Code = highSchool.Code, Name = highSchool.Name, ProvinceId = highSchool.ProvinceId, Address = highSchool.Address, }; context.HighSchool.Add(HighSchoolDAO); await context.SaveChangesAsync(); return(true); }
public async Task <HighSchoolDTO> GetHighSchool([FromBody] HighSchoolDTO highSchoolDTO) { if (highSchoolDTO == null) { highSchoolDTO = new HighSchoolDTO(); } var highSchool = new HighSchoolBO { Id = highSchoolDTO.Id }; highSchool = await HighSchoolService.Get(highSchool.Id); return(highSchool == null ? null : new HighSchoolDTO { Id = highSchool.Id, Code = highSchool.Code, Name = highSchool.Name, ProvinceId = highSchool.ProvinceId, }); }
public async Task <HighSchoolBO> Get(long Id) { HighSchoolBO HighSchool = await UOW.HighSchoolRepository.Get(Id); return(HighSchool); }