Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("UserID,Username")] Users users)
        {
            if (id != users.UserID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(users);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!UsersExists(users.UserID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(users));
        }
Esempio n. 2
0
        public async Task <IActionResult> Edit(int id, [Bind("BabyID,BabyName,BabyGender,BirthDate,UserID")] BabyInfo babyInfo)
        {
            if (id != babyInfo.BabyID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(babyInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!BabyInfoExists(babyInfo.BabyID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["UserID"] = new SelectList(_context.Users, "UserID", "UserID", babyInfo.UserID);
            return(View(babyInfo));
        }
        public async Task <IActionResult> Edit(int id, [Bind("NumberofDiaperChanges,BabyID")] DiaperChange diaperChange)
        {
            if (id != diaperChange.NumberofDiaperChanges)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(diaperChange);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!DiaperChangeExists(diaperChange.NumberofDiaperChanges))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BabyID"] = new SelectList(_context.BabyInfo, "BabyID", "BabyID", diaperChange.BabyID);
            return(View(diaperChange));
        }
Esempio n. 4
0
        public async Task <IActionResult> Edit(int id, [Bind("FeedingID,NumberOfFeedings,FeedingTime,BabyID")] Feeding feeding)
        {
            if (id != feeding.FeedingID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(feeding);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FeedingExists(feeding.FeedingID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BabyID"] = new SelectList(_context.BabyInfo, "BabyID", "BabyID", feeding.BabyID);
            return(View(feeding));
        }