public IHttpActionResult Put(int id, OwnershipRequest Ownership) { var originalOwnership = OwnershipService.GetById(id); var ret = OwnershipService.UpdateOwnership(originalOwnership, Ownership); return(Ok()); }
public IHttpActionResult Post(OwnershipRequest Ownership) { var result = OwnershipService.CreateOwnership(Ownership); return(Created <Entidad>("", new Entidad { Id = result.Id })); }
public Ownership CreateOwnership(OwnershipRequest Ownership) { var entityToInsert = new Ownership() { }; MergeOwnership(entityToInsert, Ownership); OwnershipRepository.Insert(entityToInsert); return(entityToInsert); }
public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream) { switch (methodId) { case 1: { SubscribeRequest request = new SubscribeRequest(); request.MergeFrom(stream); NoData response = new NoData(); BattlenetRpcErrorCode status = HandleSubscribe(request, response); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Subscribe(bgs.protocol.presence.v1.SubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", GetCallerInfo(), request.ToString(), response.ToString(), status); if (status == 0) { SendResponse(token, response); } else { SendResponse(token, status); } break; } case 2: { UnsubscribeRequest request = new UnsubscribeRequest(); request.MergeFrom(stream); NoData response = new NoData(); BattlenetRpcErrorCode status = HandleUnsubscribe(request, response); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Unsubscribe(bgs.protocol.presence.v1.UnsubscribeRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", GetCallerInfo(), request.ToString(), response.ToString(), status); if (status == 0) { SendResponse(token, response); } else { SendResponse(token, status); } break; } case 3: { UpdateRequest request = new UpdateRequest(); request.MergeFrom(stream); NoData response = new NoData(); BattlenetRpcErrorCode status = HandleUpdate(request, response); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Update(bgs.protocol.presence.v1.UpdateRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", GetCallerInfo(), request.ToString(), response.ToString(), status); if (status == 0) { SendResponse(token, response); } else { SendResponse(token, status); } break; } case 4: { QueryRequest request = new QueryRequest(); request.MergeFrom(stream); QueryResponse response = new QueryResponse(); BattlenetRpcErrorCode status = HandleQuery(request, response); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Query(bgs.protocol.presence.v1.QueryRequest: {1}) returned bgs.protocol.presence.v1.QueryResponse: {2} status: {3}.", GetCallerInfo(), request.ToString(), response.ToString(), status); if (status == 0) { SendResponse(token, response); } else { SendResponse(token, status); } break; } case 5: { OwnershipRequest request = new OwnershipRequest(); request.MergeFrom(stream); NoData response = new NoData(); BattlenetRpcErrorCode status = HandleOwnership(request, response); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.Ownership(bgs.protocol.presence.v1.OwnershipRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", GetCallerInfo(), request.ToString(), response.ToString(), status); if (status == 0) { SendResponse(token, response); } else { SendResponse(token, status); } break; } case 7: { SubscribeNotificationRequest request = new SubscribeNotificationRequest(); request.MergeFrom(stream); NoData response = new NoData(); BattlenetRpcErrorCode status = HandleSubscribeNotification(request, response); Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.SubscribeNotification(bgs.protocol.presence.v1.SubscribeNotificationRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.", GetCallerInfo(), request.ToString(), response.ToString(), status); if (status == 0) { SendResponse(token, response); } else { SendResponse(token, status); } break; } /*case 8: * { * MigrateOlympusCustomMessageRequest request = new MigrateOlympusCustomMessageRequest(); * request.MergeFrom(stream); * * * MigrateOlympusCustomMessageResponse response = new MigrateOlympusCustomMessageResponse(); * BattlenetRpcErrorCode status = HandleMigrateOlympusCustomMessage(request, response); * Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method PresenceService.MigrateOlympusCustomMessage(bgs.protocol.presence.v1.MigrateOlympusCustomMessageRequest: {1}) returned bgs.protocol.presence.v1.MigrateOlympusCustomMessageResponse: {2} status: {3}.", * GetCallerInfo(), request.ToString(), response.ToString(), status); * if (status == 0) * SendResponse(token, response); * else * SendResponse(token, status); * break; * }*/ default: Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId); SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod); break; } }
BattlenetRpcErrorCode HandleOwnership(OwnershipRequest request, NoData response) { Log.outError(LogFilter.ServiceProtobuf, "{0} Client tried to call not implemented method PresenceService.Ownership: {1}", GetCallerInfo(), request.ToString()); return(BattlenetRpcErrorCode.RpcNotImplemented); }
private void MergeOwnership(Ownership originalOwnership, OwnershipRequest Ownership) { originalOwnership.Address = Ownership.Address; originalOwnership.Category = Ownership.Category; }
public Ownership UpdateOwnership(Ownership originalOwnership, OwnershipRequest Ownership) { this.MergeOwnership(originalOwnership, Ownership); OwnershipRepository.Update(originalOwnership); return(originalOwnership); }