public async Task <IAdvertisementModel> IndexAsync(HttpContext context, CancellationToken cancellationToken, string AdvertisementId) { _dal = new AdvertisementDAL(); IAdvertisementModel model = await _dal.SelectByIDAsync(Convert.ToInt64(AdvertisementId), userId, cancellationToken); //await PoulateDropDownListAsync(model, cancellationToken); return(model); }
private async Task <IMainModel> PopulateInitialValuesAsync(IMainModel model, CancellationToken cancellationToken) { AdvertisementDAL _adDAL = new AdvertisementDAL(); model.categoryList = await _ddlDAL.GetCategoryListForHomePageAsync(userId, cancellationToken, false); model.themeList = await _ddlDAL.GetThemeListAsync(userId, cancellationToken, false); model.advertisementList = await _adDAL.SelectAllForHomePageAsync(cancellationToken); return(model); }
public async Task <IAdvertisementModel> SaveAsync(HttpContext context, IAdvertisementModel model, CancellationToken cancellationToken) { _dal = new AdvertisementDAL(); model.UserId = userId; if (model.AdvertisementId > 0) { context.Items[Constant.QuerySuccess] = Convert.ToBoolean(await _dal.UpdateAsync(model, cancellationToken)); context.Items[Constant.FormTitle] = "EDIT Advertisement"; } else { model.AdvertisementId = await _dal.SaveAsync(model, cancellationToken); context.Items[Constant.QuerySuccess] = Convert.ToBoolean(model.AdvertisementId); context.Items[Constant.FormTitle] = "ADD Advertisement"; } await PoulateDropDownListAsync(model, cancellationToken); return(model); }
public AdvertisementSearchService() { _dal = new AdvertisementDAL(); _ddlDal = new DropDownListDAL(); }