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