From 251cfa08455cc37ef95335e6de23f169d31a4ded Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Tue, 13 Jun 2017 18:00:49 +0200 Subject: [PATCH] Add LocationId field to UserLocation --- .../Locations.API/Infrastructure/Services/LocationsService.cs | 4 ++-- src/Services/Location/Locations.API/Model/Locations.cs | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs index cd68313fe..c8e605520 100644 --- a/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs +++ b/src/Services/Location/Locations.API/Infrastructure/Services/LocationsService.cs @@ -29,7 +29,7 @@ public async Task GetUserLocation(string userId) { - return await _locationsRepository.GetUserLocationAsync(id); + return await _locationsRepository.GetUserLocationAsync(userId); } public async Task> GetAllLocation() @@ -52,7 +52,7 @@ var userLocation = await _locationsRepository.GetUserLocationAsync(userId); userLocation = userLocation ?? new UserLocation(); userLocation.UserId = userId; - userLocation.LocationId = currentUserAreaLocationList[0].Id; + userLocation.LocationId = currentUserAreaLocationList[0].LocationId; userLocation.UpdateDate = DateTime.UtcNow; await _locationsRepository.UpdateUserLocationAsync(userLocation); diff --git a/src/Services/Location/Locations.API/Model/Locations.cs b/src/Services/Location/Locations.API/Model/Locations.cs index 0944008a7..df521b9b7 100644 --- a/src/Services/Location/Locations.API/Model/Locations.cs +++ b/src/Services/Location/Locations.API/Model/Locations.cs @@ -7,8 +7,10 @@ public class Locations { + [BsonId] [BsonRepresentation(BsonType.ObjectId)] public string Id { get; set; } + public int LocationId { get; set; } public string Code { get; set; } [BsonRepresentation(BsonType.ObjectId)] public string Parent_Id { get; set; }