Example #1
0
        public IActionResult DeleteEntry(int id)
        {
            Entry entry = _fitnessLogDbContext.Entries.Find(id);

            if (entry == null)
            {
                return(NotFound($"Could not find entry with Id = {id}"));
            }
            _fitnessLogDbContext.Remove(entry);

            _fitnessLogDbContext.SaveChanges();
            return(Ok("Entry successfully deleted."));
        }
        public IActionResult DeleteEntry(int id)
        {
            User user = _fitnessLogDbContext.Users.Find(id);

            if (user == null)
            {
                return(NotFound($"Could not find user with Id = {id}"));
            }
            _fitnessLogDbContext.Remove(user);

            _fitnessLogDbContext.SaveChanges();
            return(Ok("User successfully deleted."));
        }