#418 crud in service level

This commit is contained in:
Hamid Reza Mohammadi 2023-12-15 20:52:54 +03:30
parent 8ffc38b736
commit 4851f33c65
2 changed files with 53 additions and 0 deletions

View File

@ -17481,6 +17481,13 @@
<param name="metre"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetGanjoorQuotedPoemByIdAsync(System.Guid)">
<summary>
get quoted by id
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.InsertGanjoorQuotedPoemAsync(RMuseum.Models.Ganjoor.GanjoorQuotedPoem)">
<summary>
insert quoted poem
@ -17495,6 +17502,13 @@
<param name="quoted"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.DeleteGanjoorQuotedPoemByIdAsync(System.Guid)">
<summary>
delete quoted by id
</summary>
<param name="id"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetGanjoorQuotedPoemsAsync(System.Nullable{System.Int32},System.Nullable{System.Int32},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean},System.Nullable{System.Boolean})">
<summary>
get quoted poems

View File

@ -16,6 +16,24 @@ namespace RMuseum.Services.Implementation
/// </summary>
public partial class GanjoorService : IGanjoorService
{
/// <summary>
/// get quoted by id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<RServiceResult<GanjoorQuotedPoem>> GetGanjoorQuotedPoemByIdAsync(Guid id)
{
try
{
return new RServiceResult<GanjoorQuotedPoem>(await _context.GanjoorQuotedPoems.AsNoTracking().Where(q => q.Id == id).SingleAsync());
}
catch (Exception exp)
{
return new RServiceResult<GanjoorQuotedPoem>(null, exp.ToString());
}
}
/// <summary>
/// insert quoted poem
/// </summary>
@ -86,6 +104,27 @@ namespace RMuseum.Services.Implementation
}
}
/// <summary>
/// delete quoted by id
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public async Task<RServiceResult<bool>> DeleteGanjoorQuotedPoemByIdAsync(Guid id)
{
try
{
var q = await _context.GanjoorQuotedPoems.Where(q => q.Id == id).SingleAsync();
_context.Remove(q);
await _context.SaveChangesAsync();
return new RServiceResult<bool>(true);
}
catch (Exception exp)
{
return new RServiceResult<bool>(false, exp.ToString());
}
}
/// <summary>
/// get quoted poems
/// </summary>