Example #1
0
        public void Put(int id, MissionView view)
        {
            view.id = id;
            var model = view.getModel(repo);

            model.updated = DateTime.UtcNow;
            repo.update(model);
        }
Example #2
0
        public HttpResponseMessage Post(MissionView view)
        {
            var model = view.getModel(repo);

            model.created = DateTime.UtcNow;
            model.updated = DateTime.UtcNow;
            model.enabled = true;
            model.fakeId  = Guid.NewGuid();
            model         = repo.createMission(model);
            view          = new MissionView(model);

            var    response = Request.CreateResponse <MissionView>(HttpStatusCode.Created, view);
            string uri      = Url.Route(null, new { id = view.id });

            response.Headers.Location = new Uri(Request.RequestUri, uri);
            return(response);
        }