docs: #379 #380 SetCategoryExtraInfo

This commit is contained in:
Hamid Reza Mohammadi 2023-04-12 08:13:38 +03:30
parent fd3aacf010
commit bf31814c9c
3 changed files with 70 additions and 0 deletions

View File

@ -12497,6 +12497,17 @@
<param name="mainSections"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.SetCategoryExtraInfo(System.Int32,System.String,System.Nullable{System.Guid},System.Boolean,System.String)">
<summary>
Update category extra info
</summary>
<param name="catId"></param>
<param name="bookName"></param>
<param name="imageId"></param>
<param name="sumUpSubsGeoLocations"></param>
<param name="mapName"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.IGanjoorService.GetPageByUrl(System.String,System.Boolean)">
<summary>
get page by url
@ -15670,6 +15681,17 @@
<param name="mainSections"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.SetCategoryExtraInfo(System.Int32,System.String,System.Nullable{System.Guid},System.Boolean,System.String)">
<summary>
Update category extra info
</summary>
<param name="catId"></param>
<param name="bookName"></param>
<param name="imageId"></param>
<param name="sumUpSubsGeoLocations"></param>
<param name="mapName"></param>
<returns></returns>
</member>
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetCatById(System.Int32,System.Boolean,System.Boolean)">
<summary>
get cat by id

View File

@ -62,6 +62,17 @@ namespace RMuseum.Services
/// <returns></returns>
Task<RServiceResult<GanjoorPoetCompleteViewModel>> GetCatByUrl(string url, bool poems = false, bool mainSections = false);
/// <summary>
/// Update category extra info
/// </summary>
/// <param name="catId"></param>
/// <param name="bookName"></param>
/// <param name="imageId"></param>
/// <param name="sumUpSubsGeoLocations"></param>
/// <param name="mapName"></param>
/// <returns></returns>
Task<RServiceResult<GanjoorCatViewModel>> SetCategoryExtraInfo(int catId, string bookName, Guid? imageId, bool sumUpSubsGeoLocations, string mapName);
/// <summary>
/// get page by url
/// </summary>

View File

@ -172,6 +172,43 @@ namespace RMuseum.Services.Implementation
return await GetCatById(cat.Id, poems, mainSections);
}
/// <summary>
/// Update category extra info
/// </summary>
/// <param name="catId"></param>
/// <param name="bookName"></param>
/// <param name="imageId"></param>
/// <param name="sumUpSubsGeoLocations"></param>
/// <param name="mapName"></param>
/// <returns></returns>
public async Task<RServiceResult<GanjoorCatViewModel>> SetCategoryExtraInfo(int catId, string bookName, Guid? imageId, bool sumUpSubsGeoLocations, string mapName)
{
try
{
var cat = await _context.GanjoorCategories.Where(c => c.Id == catId).SingleOrDefaultAsync();
if (cat == null)
return new RServiceResult<GanjoorCatViewModel>(null);//not found
cat.BookName = bookName;
cat.RImageId = imageId;
cat.SumUpSubsGeoLocations = sumUpSubsGeoLocations;
cat.MapName = mapName;
_context.Update(cat);
await _context.SaveChangesAsync();
return new RServiceResult<GanjoorCatViewModel>
(
new GanjoorCatViewModel()
{
RImageId = imageId,
}
);
}
catch (Exception exp)
{
return new RServiceResult<GanjoorCatViewModel>(null, exp.ToString());
}
}
/// <summary>
/// get cat by id
/// </summary>