예제 #1
0
        public async Task<ActionResult> CreateReward(int id, RewardInformation model, HttpPostedFileBase ThumbnailPath, HttpPostedFileBase ImagePath)
        {
            using (var serviceEngine = new ServiceHelper())
            {
                var uploader = new UploadImageHelper();
                const char TypeSpliter = '/';
                var thumbnailFileName = string.Format("{0}.{1}", Guid.NewGuid(), ThumbnailPath.ContentType.Split(TypeSpliter).Last());
                var imageFileName = string.Format("{0}.{1}", Guid.NewGuid(), ThumbnailPath.ContentType.Split(TypeSpliter).Last());

                model.ThumbnailPath = await uploader.UploadImage(thumbnailFileName, ThumbnailPath.InputStream, "thumbnails");
                model.ImagePath = await uploader.UploadImage(imageFileName, ImagePath.InputStream, "images");
                model.RewardGroupId = id;

                await serviceEngine.Client.PostAsync<RewardInformation>("/Reward/CreateReward", model);
                return RedirectToAction("Details", new { id = id });
            }
        }
예제 #2
0
 public void CreateReward(RewardInformation model)
 {
     var rewardFacade = new RewardFacade();
     rewardFacade.CreateReward(model);
 }
예제 #3
0
 public void CreateReward(RewardInformation model)
 {
     var rewardDac = FacadeRepository.Instance.RewardDataAccess;
     rewardDac.CreateReward(model);
 }
예제 #4
0
 public void CreateReward(RewardInformation model)
 {
     using (var dctx = new DailySoccer.DAC.EF.DailySoccerModelContainer())
     {
         dctx.Rewards.Add(new Reward
         {
             Id = model.Id,
             Name = model.Name,
             Description = model.Description,
             Amount = model.Amount,
             RemainingAmount = model.Amount,
             ImagePath = model.ImagePath,
             ThumbnailPath = model.ThumbnailPath,
             RewardGroupId = model.RewardGroupId,
         });
         dctx.SaveChanges();
     }
 }