예제 #1
0
        public TeamWOChg AddTeam(TeamOnly newTeam)
        {
            var teamEntity = _autoMapper.Map <Data.Entities.Team>(newTeam);

            teamEntity.Chg.Add(
                new Data.Entities.Chg()
            {
                ChgDate  = _dateTime.UtcNow,
                ChgState = _chgStateQueryProcessor.Get(4), // Team -> Create
                ChgBy    = _usrQueryProcessor.Get(1)       // Default user
            }
                );

            _queryProcessor.AddTeam(teamEntity);

            var team = _autoMapper.Map <TeamWOChg>(teamEntity);

            // TODO: Implement link service
            team.AddLink(new Link
            {
                Method = HttpMethod.Get.Method,
                Href   = Mss.Common.Constants.DefaultLegacyNamespace +
                         Mss.Common.Constants.CommonRoutingDefinitions.ApiSegmentName + '/' +
                         Mss.Common.Constants.CommonRoutingDefinitions.CurrentApiVersion + '/' +
                         Mss.Common.Constants.CommonControllerDefinitions.Team + '/' + team.Id,
                Rel = Constants.CommonLinkRelValues.Self
            });

            return(team);
        }
        public IHttpActionResult AddTeam(HttpRequestMessage requestMessage, TeamOnly newTeam)
        {
            var team   = _addTeamMaintenanceProcessor.AddTeam(newTeam);
            var result = new TeamCreatedActionResult(requestMessage, team);

            return(result);
        }