public async Task <int> AddSchoolLocation(SchoolLocationDTO location) { if (location == null) { throw new ArgumentNullException($"School cannot be null"); } var newSchoolLocation = mapper.Map <SchoolLocation>(location); await _ctx.SchoolLocations.AddAsync(newSchoolLocation); await _ctx.SaveChangesAsync(); return(newSchoolLocation.SchoolId); }
public async Task <SchoolLocationDTO> UpdateSchoolLocation(SchoolLocationDTO locationSrc) { var entityDest = await _ctx.SchoolLocations.FindAsync(locationSrc.SchoolLocationId); if (entityDest != null) { mapper.Map(locationSrc, entityDest); await _ctx.SaveChangesAsync(); } else { return(null); } return(await Task.FromResult(locationSrc)); }
public async Task <SchoolLocationDTO> UpdateSchoolLocation(SchoolLocationDTO schoolLocation) { return(await _schoolService.UpdateSchoolLocation(schoolLocation)); }
public async Task <int> AddSchoolLocation(SchoolLocationDTO schoolLocation) { return(await _schoolService.AddSchoolLocation(schoolLocation)); }
public async Task <SchoolLocationDTO> UpdateSchoolLocation(SchoolLocationDTO location) { return(await _schoolRepository.UpdateSchoolLocation(location)); }
public async Task <int> AddSchoolLocation(SchoolLocationDTO location) { return(await _schoolRepository.AddSchoolLocation(location)); }