public async Task <IActionResult> UpdateTalentRichlistRisorse(RichiesteListaRisorseDto richiesteListaRisorseDto) { try { if (richiesteListaRisorseDto == null) { return(NotFound()); } await _richiesteManager.UpdateTalentRichlistRisorseAsync(richiesteListaRisorseDto, User); // creating the azioni object passing the related details and description. var azioniDto = _utilityManager.GetAzioniDtoObject(User, "update", "talent_rich_lista_risorse"); // logging the activity record by the user. await _azioniManager.AzioniInsert(azioniDto); return(Ok()); } catch (Exception x) { // Code block of Exception handling and logging into log_operazione table. var errorObj = await _utilityManager.ReturnErrorObj(x, User, "Update Talent_Richlist_Risorse"); // Returning the error object. return(BadRequest(errorObj)); } }
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)); } }
public async Task <int> InsertRichlistRisorseAsync(RichiesteListaRisorseDto richiesteListaRisorseDto, ClaimsPrincipal User) { try { RichiesteListaRisorse richListRisorse = _mapper.Map <RichiesteListaRisorseDto, RichiesteListaRisorse>(richiesteListaRisorseDto); richListRisorse.RichlistUltimaSelUteId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"))?.Value; richListRisorse.RichlistUltimaSelData = DateTime.Now; richListRisorse.RichlistInsUteId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"))?.Value; richListRisorse.RichlistInsTimestamp = DateTime.Now; richListRisorse.RichlistModUteId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"))?.Value; richListRisorse.RichlistModTimestamp = DateTime.Now; richListRisorse.RichlistCliId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/sid"))?.Value; _unitOfWork.RichiesteListaRisorse.Add(richListRisorse); await _unitOfWork.CompleteAsync(); return(richListRisorse.RichlistId); } catch (Exception) { throw; } }
public async Task <int> UpdateRichlistRisorseAsync(RichiesteListaRisorseDto richiesteListaRisorseDto) { try { RichiesteListaRisorse richListRisorse = await _unitOfWork.RichiesteListaRisorse .FirstOrDefaultAsync(c => c.RichlistRichId == richiesteListaRisorseDto.RichlistRichId && c.RichlistCliId == richiesteListaRisorseDto.RichlistCliId && c.RichlistRisId == richiesteListaRisorseDto.RichlistRisId); richListRisorse.RichlistVoto = richiesteListaRisorseDto.RichlistVoto; await _unitOfWork.CompleteAsync(); return(richListRisorse.RichlistId); } catch (Exception) { throw; } }
public async Task <int> UpdateTalentRichlistRisorseAsync(RichiesteListaRisorseDto richiesteListaRisorseDto, ClaimsPrincipal User) { try { TalentRichiesteListaRisorse talentRichiesteListaRisorse = await _unitOfWork.TalentRichiesteListaRisorse .FirstOrDefaultAsync(c => c.TrichlistRichId == richiesteListaRisorseDto.RichlistRichId && c.TrichlistCliId == richiesteListaRisorseDto.RichlistCliId && c.TrichlistRisId == richiesteListaRisorseDto.RichlistRisId); _mapper.Map(richiesteListaRisorseDto, talentRichiesteListaRisorse); talentRichiesteListaRisorse.TrichlistModUteId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"))?.Value; talentRichiesteListaRisorse.TrichlistModTimestamp = DateTime.Now; await _unitOfWork.CompleteAsync(); return(talentRichiesteListaRisorse.TrichlistId); } catch (Exception) { throw; } }