예제 #1
0
        public async Task <IActionResult> ManageTalentRichlistRisorse([FromBody] RichiesteListaRisorseDto richiesteListaRisorseDto)
        {
            try
            {
                int count = await _richiesteManager.CountFindByTalentRichlistRisorseAsync
                                (richiesteListaRisorseDto.RichlistRichId,
                                richiesteListaRisorseDto.RichlistRisId, User);

                // creating the azioni object passing the related details and description.
                var azioniDto = _utilityManager.GetAzioniDtoObject(User, "get", "count talent_rich_lista_risorse");
                // logging the activity record by the user.
                await _azioniManager.AzioniInsert(azioniDto);

                if (count == 0)
                {
                    var data = InsertTalentRichlistRisorse(richiesteListaRisorseDto);
                    return(Ok());
                }
                else
                {
                    var data = InsertTalentRichlistRisorse(richiesteListaRisorseDto);
                    return(Ok());
                }
            }
            catch (Exception x)
            {
                // Code block of Exception handling and logging into log_operazione table.
                var errorObj = await _utilityManager.ReturnErrorObj(x, User, "Count talent_rich_lista_risorse");

                // Returning the error object.
                return(BadRequest(errorObj));
            }
        }