public bool SetDefault(int userId, int id) { if (id <= 0 || userId <= 0) { return(false); } using (var cxt = DbContext(DbOperation.Write)) { cxt.BeginTransaction(); var repo = new UserAddressRepo(cxt); var flag = repo.SetDefault(userId, id); if (flag) { cxt.Commit(); } else { cxt.Rollback(); } return(flag); } }
public UserAddressDto GetDefault(int userId) { if (userId <= 0) { return(null); } using (var cxt = DbContext(DbOperation.Read)) { var repo = new UserAddressRepo(cxt); return(repo.GetDefault(userId)); } }
public IEnumerable <UserAddressDto> List(int userId) { if (userId <= 0) { return(null); } using (var cxt = DbContext(DbOperation.Read)) { var repo = new UserAddressRepo(cxt); return(repo.List(userId)); } }