public Address GetByUser(int userId)
{
try
{
var db = _addressRepository.Find(a => a.UserId == userId, true).FirstOrDefault();
if (db != null)
{
return AddressMapper.ToDto(db);
}
return new Address().GenerateError<Address>(
(int) Constants.Error.RecordNotFound,
string.Format("No address found for user with Id {0}", userId));
}
catch (Exception ex)
{
throw new BlogException(ex.Message, ex.InnerException);
}
}