/// <summary> /// Adiciona un caso en la aplicación Service Desk /// </summary> /// <param name="input">Parámetros para crear un caso </param> /// <param name="user">Usuario autenticado</param> /// <returns>estado del caso creado</returns> public async Task <OutputResponseCaseAsdkV8Dto> Create(InputCreateCaseAsdkV8Dto input) { UrlParameters parameterUrl = new UrlParameters { itemType = input.CaseType }; string uriCreateCase = ConfigurationService.UrlCreateCase.ConvertUrl(parameterUrl); string endpoint = ConfigurationService.UrlServiceDesk + uriCreateCase; CreateCaseV8 createCase = input.MapperModel(new CreateCaseV8()); createCase.AuthorId = Principal.User().Id; List <AnswerGeneralV8Api> listProperty = new List <AnswerGeneralV8Api>(); listProperty.FillProperties(createCase, true); List <AnswerGeneralV8Api> answerApi = await ConnectionService.PostAsync <List <AnswerGeneralV8Api> >(Principal.User().KeyAuthorization, endpoint, listProperty); OutputResponseCaseAsdkV8Dto answerCreate = answerApi.ConvertModel(new OutputResponseCaseAsdkV8Dto()); if (input.AdditionalFields?.Count > 0 && answerCreate?.ItemId > 0) { await UpdateAdditionalFields(input.AdditionalFields, answerCreate.ItemId, input.CaseType); } return(answerCreate); }
public async Task <ActionResult <OutputResponseCaseAsdkV8Dto> > Create(InputCreateCaseAsdkV8Dto inputCreateCase) { ActionResult <OutputResponseCaseAsdkV8Dto> actionResult; try { actionResult = Ok(await ManagmentService.Create(inputCreateCase)); } catch (Exception ex) { actionResult = NotFound(ex.Message); } return(actionResult); }