Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="p"></param>
        public void Update(ModelPlaylist p)
        {
            Name     = p.Name;
            Interval = p.Interval;

            Items = p.ToEntity().Items;
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="team"></param>
        /// <returns></returns>
        public OperationResult <ModelPlaylist> Create(ModelPlaylist p)
        {
            OperationResult <ModelPlaylist> res;

            try
            {
                var entity = p.ToEntity();

                DataContext.Add(entity);

                DataContext.SaveChanges();

                var model = entity.ToModel();
                p.Id = entity.Id;

                res = OperationResult <ModelPlaylist> .Create(model);
            }
            catch (Exception e)
            {
                res = OperationResult <ModelPlaylist> .Create(ErrorCode.BadCreatePlaylist, e);
            }

            return(res);
        }