package cn.edu.tju.se.base.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.edu.tju.se.base.dao.AddressRepository;
import cn.edu.tju.se.base.domain.Address;
import cn.edu.tju.se.base.service.AddressService;

@Service
public class AddressServiceImpl implements AddressService {

	@Autowired AddressRepository addressRepository;
	@Override
	public Address get(Long id) {
		// TODO Auto-generated method stub
		return addressRepository.findOne(id);
	}

	@Override
	public Address update(Address address) {
		// TODO Auto-generated method stub
		return addressRepository.save(address);
	}

	@Override
	public Address add(Address address) {
		// TODO Auto-generated method stub
		return addressRepository.save(address);
	}

	@Override
	public void remove(Long id) {
		// TODO Auto-generated method stub
		addressRepository.delete(id);
	}

	@Override
	public List<Address> getAll() {
		// TODO Auto-generated method stub
		return addressRepository.findAll();
	}

}
