コード例 #1
0
        private void UpdateNGOInvitation(long invitationId, int statusId)
        {
            try
            {
                UpdateNGOInvitationDTO updatedNGOInvitation = new UpdateNGOInvitationDTO()
                {
                    Id       = Convert.ToInt64(invitationId),
                    StatusId = statusId
                };

                ServiceResult <bool> serviceResult = new ServiceResult <bool>();
                var queryString = new Dictionary <string, string>();
                var response    = ApiHelper.CallSendApiMethod(ApiKeys.ProjectApiUrl, "UpdateNGOInvitation", queryString, updatedNGOInvitation);
                if (!response.IsSuccessStatusCode)
                {
                    throw new Exception("Hata oluştu!");
                }
                var data = response.Content.ReadAsStringAsync().Result;
                serviceResult = JsonConvert.DeserializeObject <ServiceResult <bool> >(data);

                if (serviceResult.ServiceResultType != EnumServiceResultType.Success)
                {
                    throw new Exception(serviceResult.ErrorMessage);
                }

                GetNGOInvitationList();
            }
            catch (Exception ex)
            {
            }
        }
コード例 #2
0
        public IHttpActionResult UpdateNGOInvitation(UpdateNGOInvitationDTO model)
        {
            if (!Request.Headers.Contains("apiKey"))
            {
                return(Unauthorized());
            }

            string apiKey = Request.Headers.GetValues("apiKey").First();

            if (!ApiHelper.CheckKey(apiKey))
            {
                return(Unauthorized());
            }

            try
            {
                var serviceResult = _projectService.UpdateNGOInvitation(model);
                return(Ok(serviceResult));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }