public void Execute(LocationDto request) { validations.ValidateAndThrow(request); var location = new Location { CityName = request.CityName }; _context.Add(location); _context.SaveChanges(); }
public void Execute(LocationDto request) { var location = _context.Locations.Find(request.Id); if (location == null) { throw new EntityNotFoundException(request.Id, typeof(Location)); } _validator.ValidateAndThrow(request); _mapper.Map(request, location); _context.SaveChanges(); }