Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public AdvertisementSearchService()
 {
     _dal    = new AdvertisementDAL();
     _ddlDal = new DropDownListDAL();
 }