Пример #1
0
        public IHttpActionResult UpdateProjectDetailActivity(UpdateProjectDetailActivityDTO 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.UpdateProjectDetailActivity(model);
                return(Ok(serviceResult));
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
Пример #2
0
        private void UpdateProjectDetailActivity(long projectDetailActivityId, int statusId)
        {
            var projectId       = ProjectId.Value;
            var projectDetailId = ProjectDetailId.Value;

            try
            {
                UpdateProjectDetailActivityDTO updateProjectDetailActivity = new UpdateProjectDetailActivityDTO()
                {
                    ProjectDetailActivityId = Convert.ToInt64(projectDetailActivityId),
                    ProjectId       = Convert.ToInt64(ProjectId.Value),
                    ProjectDetailId = Convert.ToInt64(ProjectDetailId.Value),
                    StatusId        = statusId
                };

                ServiceResult <bool> serviceResult = new ServiceResult <bool>();
                var queryString = new Dictionary <string, string>();
                var response    = ApiHelper.CallSendApiMethod(ApiKeys.ProjectApiUrl, "UpdateProjectDetailActivity", queryString, updateProjectDetailActivity);
                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);
                }

                GetActivityList(Convert.ToInt64(projectId), Convert.ToInt64(projectDetailId));
            }
            catch (Exception ex)
            {
            }
        }