Add LocationId field to UserLocation

This commit is contained in:
Christian Arenas 2017-06-13 18:00:49 +02:00
parent 486ba1872a
commit 68dbc92172
2 changed files with 4 additions and 2 deletions

View File

@ -29,7 +29,7 @@
public async Task<UserLocation> GetUserLocation(string userId) public async Task<UserLocation> GetUserLocation(string userId)
{ {
return await _locationsRepository.GetUserLocationAsync(id); return await _locationsRepository.GetUserLocationAsync(userId);
} }
public async Task<List<Locations>> GetAllLocation() public async Task<List<Locations>> GetAllLocation()
@ -52,7 +52,7 @@
var userLocation = await _locationsRepository.GetUserLocationAsync(userId); var userLocation = await _locationsRepository.GetUserLocationAsync(userId);
userLocation = userLocation ?? new UserLocation(); userLocation = userLocation ?? new UserLocation();
userLocation.UserId = userId; userLocation.UserId = userId;
userLocation.LocationId = currentUserAreaLocationList[0].Id; userLocation.LocationId = currentUserAreaLocationList[0].LocationId;
userLocation.UpdateDate = DateTime.UtcNow; userLocation.UpdateDate = DateTime.UtcNow;
await _locationsRepository.UpdateUserLocationAsync(userLocation); await _locationsRepository.UpdateUserLocationAsync(userLocation);

View File

@ -7,8 +7,10 @@
public class Locations public class Locations
{ {
[BsonId]
[BsonRepresentation(BsonType.ObjectId)] [BsonRepresentation(BsonType.ObjectId)]
public string Id { get; set; } public string Id { get; set; }
public int LocationId { get; set; }
public string Code { get; set; } public string Code { get; set; }
[BsonRepresentation(BsonType.ObjectId)] [BsonRepresentation(BsonType.ObjectId)]
public string Parent_Id { get; set; } public string Parent_Id { get; set; }