public async Task AddBanner(int bannerId, string bannerImage, string url, string remark) { using (IDAL.IBannerService Svc = new BannerService()) { await Svc.CreateAsync(new Banner { ModifyTime = DateTime.Now, BannerId = bannerId, Image = bannerImage, Url = url, Remark = remark }); } }
public async Task <IActionResult> Add(BannerEditModel model, BannerSize size) { if (ModelState.IsValid) { var seller = await HttpContext.GetMemberAsync(); var banner = new Banner(); await _appService.PrepareBannerAsync(banner, model); banner.SellerId = seller.Id; await _bannerService.CreateAsync(banner); await SaveBannerImage(banner, model); TempData.AddAlert(AlertMode.Notify, AlertType.Success, $"\"{banner.Title}\" banner was added."); } return(RedirectToAction(nameof(Index))); }