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); } }
public Task DeleteAsync(TRole role) { if (role == null) { throw new ArgumentNullException("user"); } rolesRepo.Delete(role.Id); return(Task.FromResult <Object>(null)); }
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")); }
public IHttpActionResult Delete(int id) { try { _rolesRepository.Delete(id); return(Ok()); } catch (Exception e) { return(BadRequest(e.Message)); } }
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"); }
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")); }
public bool Delete(int id) { return(rr.Delete(id)); }