public async Task <IHttpActionResult> GetEmendamenti(EmendamentiByQueryModel model) { try { return(Ok(new BaseResponse <EmendamentiDto>(model.page, model.size, await _logicEm.GetEmendamenti(model), null, await _logicEm.CountEM(model.Query)))); } catch (Exception e) { Log.Error("JOB - GetEmendamenti", e); return(ErrorHandler(e)); } }
public async Task <IHttpActionResult> GetEmendamenti(BaseRequest <EmendamentiDto> model) { ///TODO: implementare i controlli anche sull'atto try { var atto = await _logicAtti.GetAtto(model.id); if (atto == null) { return(NotFound()); } object CLIENT_MODE; model.param.TryGetValue("CLIENT_MODE", out CLIENT_MODE); // per trattazione aula var session = await GetSession(); var persona = await _logicPersone.GetPersona(session); var results = await _logicEm.GetEmendamenti(model, persona, Convert.ToInt16(CLIENT_MODE)); return(Ok(new EmendamentiViewModel { Data = new BaseResponse <EmendamentiDto>( model.page, model.size, results, model.filtro, await _logicEm.CountEM(model, persona, Convert.ToInt16(CLIENT_MODE)), Request.RequestUri), Atto = Mapper.Map <ATTI, AttiDto>(atto), Mode = (ClientModeEnum)Convert.ToInt16(CLIENT_MODE), CurrentUser = persona })); } catch (Exception e) { Log.Error("GetEmendamenti", e); return(ErrorHandler(e)); } }