/// <summary> /// Function to delete a UserActionEntity from database. /// </summary> /// <param name="userActionEntity">UserActionEntity to delete</param> /// <param name="session">User's session identifier.</param> /// <returns>null if the UserActionEntity was deleted successfully, the same UserActionEntity otherwise</returns> /// <exception cref="ArgumentNullException"> /// if <paramref name="userActionEntity"/> is null. /// </exception> /// <exception cref="UtnEmallBusinessLogicException"> /// If an UtnEmallDataAccessException occurs in DataModel. /// </exception> public UserActionEntity Delete(UserActionEntity userActionEntity, string session) { bool permited = ValidationService.Instance.ValidatePermission(session, "delete", "UserAction"); if (!permited) { ExceptionDetail detail = new ExceptionDetail(new UtnEmall.Server.BusinessLogic.UtnEmallPermissionException("The user hasn't permissions to delete an entity")); throw new FaultException <ExceptionDetail>(detail); } if (userActionEntity == null) { throw new ArgumentException("The argument can not be null or be empty"); } try { // Delete userActionEntity using data access object useractionDataAccess.Delete(userActionEntity); return(null); } catch (UtnEmallDataAccessException utnEmallDataAccessException) { throw new UtnEmall.Server.BusinessLogic.UtnEmallBusinessLogicException(utnEmallDataAccessException.Message, utnEmallDataAccessException); } }