logger.LogInformation(message:"get admin : bad request (page or/and count incorrect)");
logger.LogInformation(message:"get admin : bad request (page or/and count incorrect)");
@ -120,7 +118,7 @@ namespace WebApi.Controllers
}
}
elseif(tmp.administrators.Count()==0)
elseif(tmp.administrators.Count()==0)
{
{
logger.LogWarning(message:$"get admin : no content. number of element : {mgr.getNbElements()}, page wanted : {page}, number of elements in a page : {count}");
logger.LogWarning(message:$"get admin : no content. number of element : {unity.getNbAdmins()}, page wanted : {page}, number of elements in a page : {count}");
returnNoContent();
returnNoContent();
}
}
else
else
@ -159,13 +157,13 @@ namespace WebApi.Controllers
logger.LogError("want to delete an administrator with an id less than 0");
logger.LogError("want to delete an administrator with an id less than 0");
returnBadRequest();
returnBadRequest();
}
}
intcount=mgr.getNbElements();// count : number of elements before opperation
intcount=unity.getNbAdmins();// count : number of elements before opperation
vartmp=awaitmgr.removeAdmin(id);
vartmp=awaitunity.removeAdmin(id);
if(tmp==null)// we don't recieve the administrator
if(tmp==null)// we don't recieve the administrator
{
{
if(mgr.getNbElements()==count)// he is not deleted
if(unity.getNbAdmins()==count)// he is not deleted
{
{
if(mgr.getAdministrator(id)!=null)
if(unity.getAdministrator(id)!=null)
{
{
logger.LogCritical(message:"remove administrator fail : administrator not removed and not recieved");
logger.LogCritical(message:"remove administrator fail : administrator not removed and not recieved");
returnStatusCode(500);
returnStatusCode(500);
@ -178,7 +176,7 @@ namespace WebApi.Controllers
}
}
else// he may be deleted
else// he may be deleted
{
{
if(mgr.getAdministrator(id)==null)// he must be deleted
if(unity.getAdministrator(id)==null)// he must be deleted
{
{
logger.LogError(message:"administrator removed but not returned");
logger.LogError(message:"administrator removed but not returned");
returnNoContent();
returnNoContent();
@ -190,7 +188,7 @@ namespace WebApi.Controllers
}
}
}
}
}
}
if(mgr.getNbElements()==count)
if(unity.getNbAdmins()==count)
{
{
// <=> we have recieved an administrator which should be deleted
// <=> we have recieved an administrator which should be deleted
// but since we have the same number of administrator than
// but since we have the same number of administrator than
logger.LogInformation(message:"get chapter : bad request (page or/and count incorrect)");
returnBadRequest(tmp.nbPages);
}
elseif(tmp.chapters.Count()==0)
{
logger.LogWarning(message:$"get chapter : no content. number of element : {unity.getNbChapters()}, page wanted : {page}, number of elements in a page : {count}");