public async Task <IActionResult> Create(AdvertisementCreateModel model)
        {
            var _User = await _UserManager.GetUserAsync(User);

            _advertisementService.Create(model, _User.Id);
            return(RedirectToAction("Index", "Home"));
        }
        public async Task <IActionResult> Create(AdvertisementFormModel model)
        {
            if (!ModelState.IsValid)
            {
                model.Categories = this.category
                                   .All()
                                   .Select(c => new SelectListItem
                {
                    Text  = c.Name,
                    Value = c.Id.ToString()
                });

                return(View(model));
            }

            var userId = this.userManager.GetUserId(this.User);

            await advertisement.Create(
                model.Name,
                model.Description,
                model.Price,
                DateTime.UtcNow,
                model.CategoryId,
                userId);

            TempData.AddSuccessMessage(string.Format(WebConstants.SuccessMessageAdvertisementCreate, model.Name));
            return(RedirectToAction(nameof(All)));
        }
        public async Task <ActionResult> Create(CreateAdvertisementRequestModel model)
        {
            var userId = User.GetId();

            var advertisementId = await _advertisementService.Create(
                model.Name,
                model.Description,
                model.Price,
                userId,
                model.Images);

            return(Created(nameof(Create), advertisementId));
        }
        public HttpResponseMessage Create(AdvertisementModel model)
        {
            var newContent    = _contentService.GetContentById(model.ContentId);
            var advertisement = new AdvertisementEntity
            {
                Title    = model.Title,
                Detail   = model.Detail,
                Continue = Convert.ToDateTime(model.Continue),
                Content  = newContent,
                Adduser  = _workContent.CurrentUser.Id,
                Addtime  = DateTime.Now,
                UpdUser  = _workContent.CurrentUser.Id,
                UpdTime  = DateTime.Now
            };

            if (_advertisementService.Create(advertisement) != null)
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(true, "数据添加成功")));
            }
            else
            {
                return(PageHelper.toJson(PageHelper.ReturnValue(false, "数据添加失败")));
            }
        }