public bool Adicionar(ExameViewModel exameViewModel) { exameViewModel.Renovado = false; var exame = Mapper.Map <ExameViewModel, Exame>(exameViewModel); var examespRenovar = _exameService.Find(e => (e.FuncionarioId == exame.FuncionarioId) && (e.TipoExameId == exame.TipoExameId) && (e.Renovado == false) && (e.Delete == false)).FirstOrDefault(); BeginTransaction(); if (examespRenovar != null) { examespRenovar.Renovado = true; _exameService.Atualizar(examespRenovar); } _exameService.Adicionar(exame); Commit(); return(true); }
public async Task <CustomResponse <Exame> > Put([FromBody] Exame exame, [FromServices] AccessManager accessManager) { return(await _service.Atualizar(exame, Guid.Parse(HttpContext.User.Identity.Name))); }