public async Task <IActionResult> UpdateAsync([FromQuery] string id, MonthlyLedger inLedger)
        {
            var ledger = _ledgerService.Find(id);
            var owner  = Auth.GetUser(User.Claims);

            _logger.LogInformation("Updating id {Id} for user {User}", id, owner);

            if (ledger == null)
            {
                _logger.LogWarning("Id {Id} for user {User} not found", id, owner);
                return(NotFound());
            }

            inLedger.UpdatedAt = DateTime.Now;
            await _ledgerService.Update(id, inLedger);

            return(NoContent());
        }
示例#2
0
        public ActionResult Edit(Guid?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var target = _ledgerService.Find(id.Value);

            if (target == null)
            {
                return(HttpNotFound());
            }
            return(View(target));
        }