Exemplo n.º 1
0
        public TeamClassificationType UpdateTeamClassificationType(TeamClassificationType teamClassificationType)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamClassificationTypeRepository teamClassificationTypeRepository = _DataRepositoryFactory.GetDataRepository <ITeamClassificationTypeRepository>();

                TeamClassificationType updatedEntity = null;

                if (teamClassificationType.TeamClassificationTypeId == 0)
                {
                    updatedEntity = teamClassificationTypeRepository.Add(teamClassificationType);
                }
                else
                {
                    updatedEntity = teamClassificationTypeRepository.Update(teamClassificationType);
                }

                return updatedEntity;
            }));
        }
Exemplo n.º 2
0
        public HttpResponseMessage GetTeamClassificationType(HttpRequestMessage request, int teamClassificationTypeId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                TeamClassificationType teamClassificationType = _TeamService.GetTeamClassificationType(teamClassificationTypeId);

                // notice no need to create a seperate model object since TeamClassificationType entity will do just fine
                response = request.CreateResponse <TeamClassificationType>(HttpStatusCode.OK, teamClassificationType);

                return response;
            }));
        }
Exemplo n.º 3
0
        public TeamClassificationType GetTeamClassificationType(int teamClassificationTypeId)
        {
            return(ExecuteFaultHandledOperation(() =>
            {
                var groupNames = new List <string>()
                {
                    BudgetModuleDefinition.GROUP_ADMINISTRATOR, BudgetModuleDefinition.GROUP_BUSINESS
                };
                AllowAccessToOperation(BudgetModuleDefinition.SOLUTION_NAME, groupNames);

                ITeamClassificationTypeRepository teamClassificationTypeRepository = _DataRepositoryFactory.GetDataRepository <ITeamClassificationTypeRepository>();

                TeamClassificationType teamClassificationTypeEntity = teamClassificationTypeRepository.Get(teamClassificationTypeId);
                if (teamClassificationTypeEntity == null)
                {
                    NotFoundException ex = new NotFoundException(string.Format("TeamClassificationType with ID of {0} is not in database", teamClassificationTypeId));
                    throw new FaultException <NotFoundException>(ex, ex.Message);
                }

                return teamClassificationTypeEntity;
            }));
        }
Exemplo n.º 4
0
        public HttpResponseMessage DeleteTeamClassificationType(HttpRequestMessage request, [FromBody] int teamClassificationTypeId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                TeamClassificationType teamClassificationType = _TeamService.GetTeamClassificationType(teamClassificationTypeId);

                if (teamClassificationType != null)
                {
                    _TeamService.DeleteTeamClassificationType(teamClassificationTypeId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No teamClassificationType found under that ID.");
                }

                return response;
            }));
        }
Exemplo n.º 5
0
        public HttpResponseMessage UpdateTeamClassificationType(HttpRequestMessage request, [FromBody] TeamClassificationType teamclassificationtypeModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var teamclassificationtype = _TeamService.UpdateTeamClassificationType(teamclassificationtypeModel);

                return request.CreateResponse <TeamClassificationType>(HttpStatusCode.OK, teamclassificationtype);
            }));
        }
Exemplo n.º 6
0
 public TeamClassificationType UpdateTeamClassificationType(TeamClassificationType teamClassificationType)
 {
     return(Channel.UpdateTeamClassificationType(teamClassificationType));
 }