Exemplo n.º 1
0
 private async void SaveClicked(object sender, EventArgs e)
 {
     var updatedMovement = new ItermediateObjects.Movement
     {
         DebtId = Movement.DebtId,
         Id     = Movement.Id,
         Reason = ReasonEntry.Text
     };
     await _serviceClient.UpdateMovement(updatedMovement);
 }
Exemplo n.º 2
0
        public ItermediateObjects.Movement Put(ItermediateObjects.Movement modifiedMovement)
        {
            var userId = User.Identity.GetUserId();
            var debt   = Context.Debts.FirstOrDefault(m => m.Id == modifiedMovement.DebtId && m.UserId == userId);

            if (debt == null)
            {
                throw new HttpResponseException(HttpStatusCode.NotFound);
            }

            var movement = Context.Movements.FirstOrDefault(m => m.DebtId == modifiedMovement.DebtId && m.Id == modifiedMovement.Id);

            movement.Reason    = modifiedMovement.Reason;
            movement.UpdatedAt = DateTimeOffset.UtcNow;
            Context.SaveChanges();
            return(AutoMapper.Mapper.Map <ItermediateObjects.Movement>(movement));
        }