Ejemplo n.º 1
0
        //----------------------------------------------------------//

        // D - Delete
        public bool DeleteUserById(int id)
        {
            var user = GetUserById(id);

            _context.Remove(user);
            return(_context.SaveChanges() != 0);
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> Delete(IFormCollection form)
        {
            int SessionEditID = (int)HttpContext.Session.GetInt32(nameof(SessionEditID));

            SessionAccountNumber = (int)HttpContext.Session.GetInt32(nameof(SessionAccountNumber));

            int.TryParse(form["BillPayID"], out int delId);

            if (delId == SessionEditID)
            {
                System.Diagnostics.Debug.WriteLine(" BP ID delete : " + delId);

                _context.Remove(await _context.BillPays.FindAsync(delId));
                await _context.SaveChangesAsync();
            }
            return(View("DisplayBP", await GetMyAccount(SessionAccountNumber)));
        }