Ejemplo n.º 1
0
        public async Task <GoodDto> CreateGood(CreateGoodInput input)
        {
            var good = new Good(input.AppId, input.ChannelId, input.Title, input.GoodText);
            var app  = await _appManager.GetByIdAsync(good.AppId);

            good.CheckedLevel = input.CheckedLevel;
            good.Comments     = input.Comments;
            good.ContentGroupNameCollection = input.GoodGroupNameCollection;
            good.FileUrl     = PageUtils.GetUrlWithoutAppDir(app, input.ImageUrl);
            good.Hits        = input.Hits;
            good.HitsByDay   = input.HitsByDay;
            good.HitsByMonth = input.HitsByMonth;
            good.HitsByWeek  = input.HitsByWeek;
            good.ImageUrl    = PageUtils.GetUrlWithoutAppDir(app, input.ImageUrl);
            good.IsChecked   = input.IsChecked;
            good.IsColor     = input.IsColor;
            good.IsHot       = input.IsHot;
            good.IsRecommend = input.IsRecommend;
            good.IsTop       = input.IsTop;
            good.VideoUrl    = PageUtils.GetUrlWithoutAppDir(app, input.ImageUrl);

            await _goodManager.CreateAsync(good);

            //await CurrentUnitOfWork.SaveChangesAsync();
            return(good.MapTo <GoodDto>());
        }