public async Task <IActionResult> PutPasswordResets(int id, PasswordResets passwordResets)
        {
            if (id != passwordResets.ResetId)
            {
                return(BadRequest());
            }

            _context.Entry(passwordResets).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PasswordResetsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #2
0
        public async Task <IActionResult> PutUsers(int id, Users users)
        {
            if (id != users.UserId)
            {
                return(BadRequest());
            }

            _context.Entry(users).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UsersExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutDailyFitness(int id, DailyFitness dailyFitness)
        {
            if (id != dailyFitness.FitnessId)
            {
                return(BadRequest());
            }

            _context.Entry(dailyFitness).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!DailyFitnessExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
        public async Task <IActionResult> PutFriendships(int id, Friendships friendships)
        {
            if (id != friendships.FriendshipId)
            {
                return(BadRequest());
            }

            _context.Entry(friendships).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!FriendshipsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #5
0
        public async Task <IActionResult> PutSleep(int id, Sleep sleep)
        {
            if (id != sleep.SleepId)
            {
                return(BadRequest());
            }

            _context.Entry(sleep).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SleepExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Example #6
0
        public async Task <IActionResult> Create([Bind("UserId,FirstName,LastName,Age,Height,Weight,Email,Password")] Users users)
        {
            if (ModelState.IsValid)
            {
                _context.Add(users);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
        public async Task <IActionResult> Create([Bind("FitnessId,UserId,FitnessDate,Weight,Steps,Water,Calories,Floors")] DailyFitness dailyFitness)
        {
            if (ModelState.IsValid)
            {
                _context.Add(dailyFitness);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", dailyFitness.UserId);
            return(View(dailyFitness));
        }
Example #8
0
        public async Task <IActionResult> Create([Bind("SleepId,UserId,Awake,Light,Deep,Rem,SleepDate")] Sleep sleep)
        {
            if (ModelState.IsValid)
            {
                _context.Add(sleep);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserId"] = new SelectList(_context.Users, "UserId", "Email", sleep.UserId);
            return(View(sleep));
        }