public IHttpActionResult AddUnit(HttpRequestMessage requestMessage, Unit newUnit) { // Delegate all work to maintenance processor var unit = _addUnitMaintenanceProcessor.AddUnit(newUnit); var result = new CreatedActionResult<Unit>(unit, requestMessage); return result; }
public void AddLinks(Unit unit) { AddAllUnitsLink(unit); AddUpdateUnitLink(unit); AddDeleteUnitLink(unit); AddCreateNewUnitLink(unit); AddLinksToChildren(unit); }
public Unit AddUnit(Unit newUnit) { // Map service model to entity model var unitEntity = _autoMapper.Map<Data.Entities.Unit>(newUnit); // Persist entity model _queryProcessor.AddUnit(unitEntity); // Map new entity model back to full service model var unit = _autoMapper.Map<Unit>(unitEntity); // Add links to service model _unitLinkService.AddLinks(unit); return unit; }
public virtual void AddUpdateUnitLink(Unit unit) { var pathFragment = string.Format("{0}/{1}", PathFragmentBase, unit.UnitId); var link = _commonLinkService.GetLink(pathFragment, "updateUnit", HttpMethod.Put); unit.AddLink(link); }
public virtual void AddLinksToChildren(Unit unit) { _technologyLinkService.AddSelfLink(unit.Technology); }
public virtual void AddCreateNewUnitLink(Unit unit) { var link = _commonLinkService.GetLink(PathFragmentBase, "createUnit", HttpMethod.Post); unit.AddLink(link); }
public virtual void AddAllUnitsLink(Unit unit) { var link = _unitPrecisLinkService.GetAllUnitsLink(); unit.AddLink(link); }