public async Task <IHttpActionResult> GetBody(GetBodyEmendamentoModel model) { try { var em = await _logicEm.GetEM(model.Id); if (em == null) { return(NotFound()); } var session = await GetSession(); var persona = await _logicPersone.GetPersona(session); var body = await _logicEm.GetBodyEM(em , await _logicFirme.GetFirme(em, FirmeTipoEnum.TUTTE) , persona , model.Template , model.IsDeposito); return(Ok(body)); } catch (Exception e) { Log.Error("GetBody", e); return(ErrorHandler(e)); } }
public async Task <string> GetBody(Guid id, TemplateTypeEnum template, bool IsDeposito = false) { var result = string.Empty; try { var requestUrl = $"{apiUrl}/emendamenti/template-body"; var model = new GetBodyEmendamentoModel { Id = id, Template = template, IsDeposito = IsDeposito }; var body = JsonConvert.SerializeObject(model); result = await Post(requestUrl, body, _token); var lst = JsonConvert.DeserializeObject <string>(result); return(lst); } catch (UnauthorizedAccessException ex) { Log.Error("GetBodyEM", ex); throw ex; } catch (Exception ex) { Log.Error($"GetBodyEM PARAMS: GUID EM [{id}], TEMPLATE [{template}]"); Log.Error($"GetBodyEM RESULT: [{result}]"); Log.Error("GetBodyEM", ex); throw ex; } }