public ActionResult <GroupModel> DeleteGroupByIf(DeleteGroupModel groupModel) { interfaceOperation = true; var creator = usersApi.FindIdUserByName(groupModel.Creator); var group = groupsApi.FindGroupByName(groupModel.GroupName); if (creator == -1) { return(RedirectToAction(nameof(MessagePage), new { message = "No such user!" })); } var permission = permissionsApi.GetPermissionForUserByGroup(creator, group.Id); if (permission == null) { return(RedirectToAction(nameof(MessagePage), new { message = "No information about permission for this group!" })); } if (permission.Operation != Operation.Admin) { return(RedirectToAction(nameof(MessagePage), new { message = "No admin permission!" })); } var result = groupsApi.DeleteGroup(groupModel.GroupName); return(RedirectToAction(nameof(GetAllGroupsByIf))); }
public ActionResult <HttpStatusCode> DeleteUser(string name) { var result = groupsApi.DeleteGroup(name); return(result.StatusCode); }