public IHttpActionResult Get(Guid?id) { //Recupero l'entity HealthRisk entity = _healthRiskService.Get <HealthRisk, Guid?>(id); //Compongo il dto HealthRiskDetailDto dto = Mapper.Map <HealthRiskDetailDto>(entity); //Ritorno i risultati return(Ok(dto)); }
public IHttpActionResult Delete(HealthRiskDetailDto dto) { //Recupero l'entity var oResult = _healthRiskService.DeleteHealthRisk(dto?.Id); //Se ci sono stati errori, li notifico if (oResult.HasErrors()) { Log4NetConfig.ApplicationLog.Warn(string.Format("Errore durante la cancellazione di una HealthRisk. Id: {0} - Errore: {1}", dto?.Id, oResult.GetValidationErrorsInline(" - "))); NHibernateHelper.SessionFactory.GetCurrentSession().Transaction.Rollback(); return(ResponseMessage(Request.CreateResponse(HttpStatusCode.BadRequest, oResult))); } //Ritorno i risultati return(ResponseMessage(Request.CreateResponse(HttpStatusCode.OK))); }