コード例 #1
0
        public HttpResponseMessage Post(Hole item)
        {
            repository.Add(item);
            var response = Request.CreateResponse(HttpStatusCode.Created, item);

            string uri = Url.Link(ConfigurationProvider.GetRouteName(), new { id = item.Id });

            response.Headers.Location = new Uri(uri);
            return(response);
        }
コード例 #2
0
        public Hole CreateHole(int holeNumber, int par)
        {
            Check.Argument.IsNotZeroOrNegative(holeNumber, "holeNumber");
            Check.Argument.IsNotZeroOrNegative(par, "par");

            var hole = new Hole()
            {
                Id = holeNumber, Par = par
            };

            _holeRepository.Add(hole);

            return(hole);
        }