Exemple #1
0
        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);
        }
Exemple #2
0
        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));
        }
Exemple #3
0
 public async Task <SchoolLocationDTO> UpdateSchoolLocation(SchoolLocationDTO schoolLocation)
 {
     return(await _schoolService.UpdateSchoolLocation(schoolLocation));
 }
Exemple #4
0
 public async Task <int> AddSchoolLocation(SchoolLocationDTO schoolLocation)
 {
     return(await _schoolService.AddSchoolLocation(schoolLocation));
 }
Exemple #5
0
 public async Task <SchoolLocationDTO> UpdateSchoolLocation(SchoolLocationDTO location)
 {
     return(await _schoolRepository.UpdateSchoolLocation(location));
 }
Exemple #6
0
 public async Task <int> AddSchoolLocation(SchoolLocationDTO location)
 {
     return(await _schoolRepository.AddSchoolLocation(location));
 }