From fb6e18e8f2d89172ecf42b919b3330980e4c1634 Mon Sep 17 00:00:00 2001 From: Adiv <asifadiv@gmail.com> Date: Sat, 15 Apr 2023 11:13:34 +0100 Subject: [PATCH] fixup again... --- Services/ProfileService.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Services/ProfileService.cs b/Services/ProfileService.cs index f49cdb7..35390f4 100644 --- a/Services/ProfileService.cs +++ b/Services/ProfileService.cs @@ -4,6 +4,7 @@ using System.Text; using AutoMapper; using Exceptions; using Microsoft.EntityFrameworkCore; +using Models; using Models.DTOs; using Models.Entities; using Repositories; @@ -41,6 +42,12 @@ public class ProfileService : IProfileService throw new ProfileException("Please enter valid age."); 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) { -- GitLab