Ejemplo n.º 1
0
                                                   public async Task <IHttpActionResult> Delete(int Id)
                                                   {
                                                       try{ log.Info(new MDCSet(this.ControllerContext.RouteData), new InfoException(Id));
                                                            await _repository.Delete(Id);

                                                            return(Ok("Rol de usuario eliminado correctamente!")); }
                                                       catch (Exception e) { log.Error(new MDCSet(this.ControllerContext.RouteData), e);
                                                                             throw new Exception(e.Message, e); }
                                                   }
Ejemplo n.º 2
0
        public Task DeleteAsync(TRole role)
        {
            if (role == null)
            {
                throw new ArgumentNullException("user");
            }

            rolesRepo.Delete(role.Id);

            return(Task.FromResult <Object>(null));
        }
Ejemplo n.º 3
0
        public IActionResult Eliminar(RolViewModel rolVM)
        {
            RolesRepository rolesRepository = new RolesRepository();
            var             rolResult       = rolesRepository.GetById(rolVM.IdRol);

            if (rolResult != null)
            {
                rolesRepository.Delete(rolResult);
            }

            return(RedirectToAction("Rol", "Administrador"));
        }
Ejemplo n.º 4
0
 public IHttpActionResult Delete(int id)
 {
     try
     {
         _rolesRepository.Delete(id);
         return(Ok());
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 5
0
        private void btnDel_Click(object sender, EventArgs e)
        {
            switch (flag)
            {
            case 1:
            {
                // Department
                _departmentRepository.Delete(selectedId);
            }
            break;

            case 2:
            {
                // Role
                _rolesRepository.Delete(selectedId);
            }
            break;

            case 3:
            {
                // User
                _usersRepository.Delete(selectedId);
            }
            break;

            case 4:
            {
                // Shift
                _shiftsRepository.Delete(selectedId);
            }
            break;

            case 5:
            {
                // Attendance
                _attendancesRepository.Delete(selectedId);
            }
            break;

            case 6:
            {
                // Payslip
                _payslipsRepository.Delete(selectedId);
            }
            break;

            default:
                break;
            }
            MessageBox.Show("Delete successfully!");
            LoadData();
        }
        public ActionResult DeleteRole(RolesDeleteRoleVM model)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            RolesRepository rolesRepository = new RolesRepository(context);

            Role role = rolesRepository.GetAll(filter: r => r.ID == model.ID, includeProperties: "AuthenticatingActions").FirstOrDefault();
            if (role == null)
            {
                return HttpNotFound();
            }

            role.AuthenticatingActions = null;
            rolesRepository.Delete(role);

            return RedirectToAction("Index", "Roles");
        }
Ejemplo n.º 7
0
        public ActionResult DeleteRole(RolesDeleteRoleVM model)
        {
            LibraryManagementSystemContext context = new LibraryManagementSystemContext();
            RolesRepository rolesRepository        = new RolesRepository(context);

            Role role = rolesRepository.GetAll(filter: r => r.ID == model.ID, includeProperties: "AuthenticatingActions").FirstOrDefault();

            if (role == null)
            {
                return(HttpNotFound());
            }

            role.AuthenticatingActions = null;
            rolesRepository.Delete(role);

            return(RedirectToAction("Index", "Roles"));
        }
Ejemplo n.º 8
0
 public bool Delete(int id)
 {
     return(rr.Delete(id));
 }