Ejemplo n.º 1
0
        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 }));
        }
Ejemplo n.º 2
0
        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());
            }
        }