public IHttpActionResult AddTechnology(HttpRequestMessage requestMessage, NewTechnology newTechnology) { // Delegate all work to maintenance processor var technology = _addTechnologyMaintenanceProcessor.AddTechnology(newTechnology); var result = new CreatedActionResult<Technology>(technology, requestMessage); return result; }
public Technology AddTechnology(NewTechnology newTechnology) { // Map service model to entity model var technologyEntity = _autoMapper.Map<Data.Entities.Technology>(newTechnology); // Persist entity model _queryProcessor.AddTechnology(technologyEntity); // Map new entity model back to full service model var technology = _autoMapper.Map<Technology>(technologyEntity); //TODO: implement Link Service technology.AddLink(new Link { Method = HttpMethod.Get.Method, Href = "http://localhost:52204/api/v1/technologies/" + technology.TechnologyId, Rel = Constants.CommonLinkRelValues.Self }); return technology; }