public async Task <IActionResult> Delete(string id) { var l = await _ensureService.FindByIdAsync(id); if (l == null || l.UserId != User.GetId()) { return(BadRequest()); } string date = l.Logged.ToString(EnsureConstants.DateTimeUrlFormat); await _ensureService.RemoveLogAsync(l); return(RedirectToAction("Logs", new { date })); }
public async Task <ActionResult> RemoveLog(string id) { var l = await _ensureService.FindByIdAsync(id); if (l == null || l.UserId == User.FindFirst(ClaimTypes.NameIdentifier).Value) { await _ensureService.RemoveLogAsync(l); return(Ok()); } else { return(BadRequest()); } }