#400 fixes and improvements

This commit is contained in:
Hamid Reza Mohammadi 2023-07-25 17:15:53 +03:30
parent a6673e3301
commit dd43dbf50d
3 changed files with 38 additions and 11 deletions

View File

@ -185,5 +185,10 @@
/// </summary>
public int? OtherContributer2Id { get; set; }
/// <summary>
/// PDF Source Id
/// </summary>
public int? PDFSourceId { get; set; }
}
}

View File

@ -12577,6 +12577,11 @@
other contributing role 2
</summary>
</member>
<member name="P:RMuseum.Models.PDFLibrary.ViewModels.NewPDFBookViewModel.PDFSourceId">
<summary>
PDF Source Id
</summary>
</member>
<member name="T:RMuseum.Models.UploadSession.UploadSession">
<summary>
Upload Session

View File

@ -151,8 +151,9 @@ namespace RMuseum.Services.Implementation
pdfBook.ClaimedPageCount = model.ClaimedPageCount == 0 ? null : model.ClaimedPageCount;
pdfBook.OriginalSourceName = model.OriginalSourceName;
pdfBook.OriginalFileUrl = model.OriginalFileUrl;
pdfBook.PDFSourceId = model.PDFSourceId;
List<AuthorRole> roles = new List<AuthorRole>();
if (model.WriterId != null && model.WriterId != 0)
if (model.WriterId != null)
{
roles.Add(new AuthorRole()
{
@ -160,7 +161,7 @@ namespace RMuseum.Services.Implementation
Role = "نویسنده",
});
}
if (model.Writer2Id != null && model.Writer2Id != 0)
if (model.Writer2Id != null)
{
roles.Add(new AuthorRole()
{
@ -168,7 +169,7 @@ namespace RMuseum.Services.Implementation
Role = "نویسنده",
});
}
if (model.Writer3Id != null && model.Writer3Id != 0)
if (model.Writer3Id != null)
{
roles.Add(new AuthorRole()
{
@ -176,7 +177,7 @@ namespace RMuseum.Services.Implementation
Role = "نویسنده",
});
}
if (model.Writer4Id != null && model.Writer4Id != 0)
if (model.Writer4Id != null)
{
roles.Add(new AuthorRole()
{
@ -184,15 +185,15 @@ namespace RMuseum.Services.Implementation
Role = "نویسنده",
});
}
if (model.TranslatorId != null && model.TranslatorId != 0)
if (model.TranslatorId != null)
{
roles.Add(new AuthorRole()
{
Author = await context.Authors.Where(a => a.Id == model.TranslatorId).SingleAsync(),
Role = "مترجم",
});
});
}
if (model.Translator2Id != null && model.Translator2Id != 0)
if (model.Translator2Id != null)
{
roles.Add(new AuthorRole()
{
@ -200,7 +201,7 @@ namespace RMuseum.Services.Implementation
Role = "مترجم",
});
}
if (model.Translator3Id != null && model.Translator3Id != 0)
if (model.Translator3Id != null)
{
roles.Add(new AuthorRole()
{
@ -208,7 +209,7 @@ namespace RMuseum.Services.Implementation
Role = "مترجم",
});
}
if (model.Translator4Id != null && model.Translator4Id != 0)
if (model.Translator4Id != null)
{
roles.Add(new AuthorRole()
{
@ -216,7 +217,7 @@ namespace RMuseum.Services.Implementation
Role = "مترجم",
});
}
if (model.CollectorId != null && model.CollectorId != 0)
if (model.CollectorId != null)
{
roles.Add(new AuthorRole()
{
@ -224,7 +225,7 @@ namespace RMuseum.Services.Implementation
Role = "مصحح",
});
}
if (model.Collector2Id != null && model.Collector2Id != 0)
if (model.Collector2Id != null)
{
roles.Add(new AuthorRole()
{
@ -232,6 +233,22 @@ namespace RMuseum.Services.Implementation
Role = "مصحح",
});
}
if(model.OtherContributerId != null && !string.IsNullOrEmpty(model.OtherContributerRole))
{
roles.Add(new AuthorRole()
{
Author = await context.Authors.Where(a => a.Id == model.OtherContributerId).SingleAsync(),
Role = model.OtherContributerRole,
});
}
if (model.OtherContributer2Id != null && !string.IsNullOrEmpty(model.OtherContributer2Role))
{
roles.Add(new AuthorRole()
{
Author = await context.Authors.Where(a => a.Id == model.OtherContributer2Id).SingleAsync(),
Role = model.OtherContributer2Role,
});
}
if (roles.Count > 0)
{
pdfBook.Contributers = roles;