Esempio n. 1
0
 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");
     }
 }
Esempio n. 2
0
 public bool DeleteMedia(UserWSDTO user, MediaWSDTO media)
 {
     if (user.IsValid && user.UserLevel >= AdminLevel)
     {
         return(Manager.DeleteMedia(Translate(media)));
     }
     else
     {
         throw new System.Web.HttpRequestValidationException("Invalid user");
     }
 }
Esempio n. 3
0
        public MediaWSDTO Translate(ControllerLayer.MediaDTO media)
        {
            MediaWSDTO Output = new MediaWSDTO();

            Output.Title       = media.Title;
            Output.Budget      = media.Budget;
            Output.BudgetValue = media.BudgetValue;
            Output.Director    = Translate(media.Director);
            Output.Genre       = Translate(media.Genre);
            Output.Language    = Translate(media.Language);
            Output.MediaID     = media.MediaID;
            Output.Year        = media.Year;
            return(Output);
        }
Esempio n. 4
0
        public ControllerLayer.MediaDTO Translate(MediaWSDTO media)
        {
            if (media.Title != null && media.Director != null && media.Genre != null && media.Language != null)
            {
                return(new ControllerLayer.MediaDTO(
                           media.Title,
                           Translate(media.Genre),
                           Translate(media.Director),
                           Translate(media.Language),
                           media.Year,
                           media.BudgetValue,
                           media.MediaID
                           ));
            }

            throw new System.Web.HttpRequestValidationException("Invalid media given");
        }