#87 assigning a user's comment to him or her after sign up
This commit is contained in:
parent
3bc28969ab
commit
b6e7b800c2
@ -2,7 +2,6 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.Extensions.Configuration;
|
using Microsoft.Extensions.Configuration;
|
||||||
using RMuseum.DbContext;
|
using RMuseum.DbContext;
|
||||||
using RSecurityBackend.DbContext;
|
|
||||||
using RSecurityBackend.Models.Auth.Db;
|
using RSecurityBackend.Models.Auth.Db;
|
||||||
using RSecurityBackend.Models.Generic;
|
using RSecurityBackend.Models.Generic;
|
||||||
using RSecurityBackend.Services;
|
using RSecurityBackend.Services;
|
||||||
@ -49,7 +48,7 @@ namespace RMuseum.Services.Implementation
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
RMuseumDbContext context = _context as RMuseumDbContext;
|
RMuseumDbContext context = _context as RMuseumDbContext;
|
||||||
var comments = await context.GanjoorComments.Where(c => c.AuthorEmail.Equals(email, StringComparison.InvariantCultureIgnoreCase)).ToListAsync();
|
var comments = await context.GanjoorComments.Where(c => c.AuthorEmail == email.ToLower()).ToListAsync();
|
||||||
if (comments.Count > 0)
|
if (comments.Count > 0)
|
||||||
{
|
{
|
||||||
var user = (await FindUserByEmail(email)).Result;
|
var user = (await FindUserByEmail(email)).Result;
|
||||||
|
|||||||
@ -586,7 +586,7 @@ namespace RMuseum.Services.Implementation
|
|||||||
PoemId = int.Parse(row["comment_post_ID"].ToString()),
|
PoemId = int.Parse(row["comment_post_ID"].ToString()),
|
||||||
AuthorName = row["comment_author"].ToString(),
|
AuthorName = row["comment_author"].ToString(),
|
||||||
AuthorEmail = row["comment_author_email"].ToString(),
|
AuthorEmail = row["comment_author_email"].ToString(),
|
||||||
AuthorUrl = row["comment_author_url"].ToString(),
|
AuthorUrl = row["comment_author_url"].ToString().ToLower(),
|
||||||
AuthorIpAddress = row["comment_author_IP"].ToString(),
|
AuthorIpAddress = row["comment_author_IP"].ToString(),
|
||||||
CommentDate = (DateTime)row["comment_date"],
|
CommentDate = (DateTime)row["comment_date"],
|
||||||
HtmlComment = _PrepareCommentHtml(row["comment_content"].ToString()),
|
HtmlComment = _PrepareCommentHtml(row["comment_content"].ToString()),
|
||||||
@ -642,7 +642,7 @@ namespace RMuseum.Services.Implementation
|
|||||||
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"{jobName} - assigning comments to users")).Result;
|
job = (await jobProgressServiceEF.UpdateJob(job.Id, 0, $"{jobName} - assigning comments to users")).Result;
|
||||||
foreach (var user in await context.Users.ToListAsync())
|
foreach (var user in await context.Users.ToListAsync())
|
||||||
{
|
{
|
||||||
foreach(var comment in await context.GanjoorComments.Where(u => u.AuthorEmail == user.Email).ToListAsync())
|
foreach(var comment in await context.GanjoorComments.Where(u => u.AuthorEmail == user.Email.ToLower()).ToListAsync())
|
||||||
{
|
{
|
||||||
comment.UserId = user.Id;
|
comment.UserId = user.Id;
|
||||||
context.GanjoorComments.Update(comment);
|
context.GanjoorComments.Update(comment);
|
||||||
|
|||||||
@ -226,7 +226,7 @@ namespace RMuseum
|
|||||||
services.AddTransient<IImageFileService, ImageFileServiceEF>();
|
services.AddTransient<IImageFileService, ImageFileServiceEF>();
|
||||||
|
|
||||||
//app user services
|
//app user services
|
||||||
services.AddTransient<IAppUserService, AppUserService>();
|
services.AddTransient<IAppUserService, GanjoorAppUserService>();
|
||||||
|
|
||||||
//user groups services
|
//user groups services
|
||||||
services.AddTransient<IUserRoleService, RoleService>();
|
services.AddTransient<IUserRoleService, RoleService>();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user