public async Task <IActionResult> Edit(int id, [Bind("Id,UserId,Date,Disruptions")] SleepCycle sleepCycle)
        {
            if (id != sleepCycle.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(sleepCycle);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!SleepCycleExists(sleepCycle.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", sleepCycle.UserId);
            return(View(sleepCycle));
        }
        public async Task <IActionResult> Create([Bind("Id,UserId,Date,Disruptions")] SleepCycle sleepCycle)
        {
            var user = await GetCurrentUserAsync();

            if (ModelState.IsValid)
            {
                var date = DateTime.Now;
                sleepCycle.UserId = user.Id;
                sleepCycle.Month  = date.Month;
                _context.Add(sleepCycle);

                await _context.SaveChangesAsync();

                return(RedirectToAction("Index", "Home"));
            }
            ViewData["UserId"] = new SelectList(_context.ApplicationUsers, "Id", "Id", sleepCycle.UserId);
            return(View());
        }