示例#1
0
    //Don't forget to override! Or the events won't work
    public override void Start()
    {
        base.Start();
        Debug.Log("Starting inspector controller");

        //Initialize the controller by casting the model to the controller you wish to use
        _movementModel = GetComponent <AbstractModelComponent>() as Bodyweight;

/*
 *      //Once initialized you can access its members and events!
 *
 *      if (_movementModel != null) {
 *          _movementModel.moves?.jumping_jack.onMove.AddListener(JJCallBack);
 *      }
 *
 *      //In this particular example I want to subscribe to ALL events except duck!
 *      foreach (MoveHolder moveHolder in modelManager.model.GetMoveHolders()) {
 *          if (moveHolder.id != MovementEnum.duck) {
 *              moveHolder.onMove.AddListener(AllEventsCallback);
 *          }
 *      }*/
    }
 public UpdateBodyweightRequest(Bodyweight entity)
 {
     Value = entity.Value;
     Date  = entity.Date;
     Id    = entity.Id;
 }
 public async Task <IActionResult> Update([FromBody] Bodyweight entity, CancellationToken cancellationToken = default)
 {
     RemoveCacheKeys($"Report/BodyweightMetrics{entity.UserId}", $"Bodyweight/GetAll{entity.UserId}");
     return(Ok(await Mediator.Send(new UpdateBodyweightRequest(entity), cancellationToken)));
 }