public async Task <int> InsertTalentRichlistRisorseAsync(RichiesteListaRisorseDto richiesteListaRisorseDto, ClaimsPrincipal User) { try { TalentRichiesteListaRisorse talentRichiesteListaRisorse = _mapper.Map <RichiesteListaRisorseDto, TalentRichiesteListaRisorse>(richiesteListaRisorseDto); talentRichiesteListaRisorse.TrichlistInsUteId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"))?.Value; talentRichiesteListaRisorse.TrichlistModUteId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier"))?.Value; talentRichiesteListaRisorse.TrichlistCliId = User.Claims.FirstOrDefault(x => x.Type.Equals("http://schemas.xmlsoap.org/ws/2005/05/identity/claims/sid"))?.Value; talentRichiesteListaRisorse.TrichlistInsTimestamp = DateTime.Now; talentRichiesteListaRisorse.TrichlistModTimestamp = DateTime.Now; // Passing data to dal _unitOfWork.TalentRichiesteListaRisorse.Add(talentRichiesteListaRisorse); await _unitOfWork.CompleteAsync(); return(talentRichiesteListaRisorse.TrichlistId); } 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; } }