Ejemplo n.º 1
0
        public async Task <IActionResult> EditOutgoing(int id, [FromBody] ApiOutgoing model)
        {
            var outgoing = await _uow.Outgoings.GetByIdAsync(id);

            outgoing.Budgeted = model.Budgeted;

            _uow.Outgoings.Update(outgoing);

            await _uow.CommitAsync();

            return(new JsonResult(model));
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> EditOutgoing(int id, [FromBody] ApiOutgoing model)
        {
            var outgoing = _uow.Outgoings.GetAll()
                           .Where(x => x.UserId == Token.UserId)
                           .Where(x => x.Id == id)
                           .FirstOrDefault();

            if (outgoing != null)
            {
                outgoing.DateModified = DateTime.UtcNow;
                outgoing.Budgeted     = model.Budgeted;
                _uow.Outgoings.Update(outgoing);
                await _uow.CommitAsync();

                return(new OkResult());
            }

            return(new NotFoundResult());
        }