Skip to content
Snippets Groups Projects
Commit 77d04d69 authored by Adiv's avatar Adiv
Browse files

Fixups

parent 1daef41b
No related branches found
No related tags found
No related merge requests found
......@@ -11,16 +11,16 @@
<PackageReference Include="AutoMapper" Version="12.0.1" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.16.0-beta.1" />
<PackageReference Include="Azure.Storage.Common" Version="12.15.0-beta.1" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="8.0.0-preview.2.23153.2" />
<PackageReference Include="Microsoft.AspNetCore.Authorization" Version="7.0.5" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="7.0.4" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.32.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0-preview.2.23128.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0-preview.2.23128.3">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0-preview.2.23128.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0-preview.2.23128.3">
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
......
......@@ -40,13 +40,12 @@ public class ProfileService : IProfileService
if (age is <= 16 or >= 100)
throw new ProfileException("Please enter valid age.");
var newDetails = _mapper.Map<Profile>(profile);
var record = _mapper.Map<Profile>(profile);
if (!string.IsNullOrWhiteSpace(newDetails.FavouriteShows))
if (profile.FavouriteShows != null && profile.FavouriteShows.Count != 0)
{
var builder = new StringBuilder();
foreach (var show in newDetails.FavouriteShows)
foreach (var show in profile.FavouriteShows)
builder.Append($"{show},");
record.FavouriteShows = builder.ToString();
......@@ -55,6 +54,8 @@ public class ProfileService : IProfileService
if (user.ProfileId == null)
{
var newProfile = await _profileRepository.CreateAndSaveAsync(record);
user.ProfileId = newProfile.Id;
await _userRepository.UpdateAndSaveAsync(user);
return _mapper.Map<ProfileDTO>(newProfile);
}
......@@ -96,6 +97,8 @@ public class ProfileService : IProfileService
BannerUrl = image.ToString()
};
await _profileRepository.CreateAndSaveAsync(newProfile);
user.ProfileId = newProfile.Id;
await _userRepository.UpdateAndSaveAsync(user);
return _storageService.GetSasForFile(Constants.AzureBlobContainer.BannerPictures, image.ToString());
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment