/// <summary> /// Deletes a profile and changes the user's idProfile to the specified /// in the users param, by default all users will be changed to a "basic" profile /// </summary> /// <param name="idProfile"> /// A string with de idProfile to delete /// </param> /// <param name="users"> /// A json string with an array of users to change its idProfile /// </param> /// <returns></returns> //[HttpPost] public void deleteProfile(string idProfile, string employees) { bool access = false; String dataPermissions = Session["Permissions"].ToString(); String dataPermissionsClient = Session["PermissionsClient"].ToString(); bool accessClient = false; access = validatepermissions.getpermissions("profiles", "d", dataPermissions); accessClient = validatepermissions.getpermissions("profiles", "d", dataPermissionsClient); if (access == true && accessClient == true) { var empList = JsonConvert.DeserializeObject <EmployeeList>(employees);//User Class already exists its used in Security Auth if (idProfile != "null" && idProfile != null && idProfile != "") { BsonDocument profile = _employeeProfileTable.getRow(idProfile); if (profile != null) { foreach (var employee in empList.employees) { _employeeTable.updateProfile(employee); } _employeeProfileTable.deleteProfile(idProfile); } } } }