Example #1
0
        public async Task <IActionResult> Edit(Guid id, [Bind("AccountID,Username,Password,Role")] Account account)
        {
            if (id != account.AccountID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(account);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AccountExists(account.AccountID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(account));
        }
Example #2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("WebCheckID,Name,Domain,Delay,CreateDate,AccountID")] WebCheck webCheck)
        {
            if (id != webCheck.WebCheckID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    // Set DateTime new
                    webCheck.CreateDate = DateTime.Now;

                    _context.Update(webCheck);
                    await _context.SaveChangesAsync();

                    WebCheckHelper.UpdateRecurringEvent(webCheck);
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!WebCheckExists(webCheck.WebCheckID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AccountID"] = new SelectList(_context.Accounts, "AccountID", "Password", webCheck.AccountID);
            return(View(webCheck));
        }