Skip to content
Snippets Groups Projects
Commit 071d4be0 authored by Adiv Asif's avatar Adiv Asif
Browse files

Merged PR 10: fixup again...

fixup again...
parents d68f24ec fb6e18e8
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,7 @@ using System.Text; ...@@ -4,6 +4,7 @@ using System.Text;
using AutoMapper; using AutoMapper;
using Exceptions; using Exceptions;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Models;
using Models.DTOs; using Models.DTOs;
using Models.Entities; using Models.Entities;
using Repositories; using Repositories;
...@@ -41,6 +42,12 @@ public class ProfileService : IProfileService ...@@ -41,6 +42,12 @@ public class ProfileService : IProfileService
throw new ProfileException("Please enter valid age."); throw new ProfileException("Please enter valid age.");
var record = _mapper.Map<Profile>(profile); var record = _mapper.Map<Profile>(profile);
if (user.ProfileId != null)
{
var existingProfile = await _profileRepository.GetAll().AsNoTracking()
.FirstOrDefaultAsync(p => p.Id == user.ProfileId);
record.Id = existingProfile!.Id;
}
if (profile.FavouriteShows != null && profile.FavouriteShows.Count != 0) if (profile.FavouriteShows != null && profile.FavouriteShows.Count != 0)
{ {
......
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