public UserWSDTO RegisterNewUser(UserWSDTO user) { //ControllerLayer.UserDTO user = new ControllerLayer.UserDTO(); //UserManager.RegisterNewUser(, user.Password); return(null); }
public MediaWSDTO AddMedia(UserWSService.UserWSDTO user, MediaWSDTO media) { if (user.IsValid && user.UserLevel >= AdminLevel) { if ( media.Genre != null && media.Genre.GID != null && media.Title != null && media.Language != null && media.Language.LID != null && media.Director != null && media.Director.DID != null ) { return(Translate(Manager.CreateMedia(Translate(media)))); } else { throw new System.Web.HttpRequestValidationException("Not enough information given"); } } else { throw new System.Web.HttpRequestValidationException("Invalid user"); } }
public IList <MediaWSDTO> MakeQuery(UserWSService.UserWSDTO user, string title = null, string genre = null, string director = null, string language = null, int?year = null) { if (user.IsValid) { return(Translate(Manager.MakeMediaQuery(title, genre, director, language, year))); } else { throw new System.Web.HttpRequestValidationException("Invalid user"); } }
public bool DeleteUser(UserWSDTO user, int iD) { if (user.IsValid && user.UserLevel >= 3) { throw new NotImplementedException(); } else { throw new System.Web.HttpRequestValidationException("Invalid user"); } }
public UserWSDTO Translate(ControllerLayer.UserDTO user) { UserWSDTO Output = new UserWSDTO(); Output.UID = user.UID; Output.Email = user.Email; Output.Username = user.Username; Output.UserLevel = user.UserLevel; Output.IsValid = user.isValid; return(Output); }
public IList <UserWSDTO> GetUsers(UserWSDTO user, int?iD = null) { if (user.IsValid && user.UserLevel >= 3) { IList <UserWSDTO> Output = new List <UserWSDTO>(); IList <ControllerLayer.UserDTO> users = UserManager.ListUsers(iD); for (int i = 0; i < users.Count; i++) { Output.Add(Translate(users[i])); } return(Output); } else { throw new System.Web.HttpRequestValidationException("Invalid user"); } }
public UserWSDTO ValidateUser(UserWSDTO user) { if (user == null) { throw new ArgumentNullException("Invalid Arguments"); } try { return(Translate(UserManager.ValidateUser(user.Username, user.Password))); } catch (Exception e) { UserWSDTO failedMessage = new UserWSDTO(); failedMessage.IsValid = false; failedMessage.ErrorMessage = e.Message; return(failedMessage); } }
public UserWSDTO ChangePassword(UserWSDTO user) { throw new NotImplementedException(); }