Exemple #1
0
        public async Task <IActionResult> Manage(SeoDetailViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                var record = this.Mapper.Map <SeoDetailModel>(model);
                if (model.Id == 0)
                {
                    record.SetAuditInfo(0);
                    await this.seoDetailServices.InsertAsync(record);

                    this.ShowMessage(Messages.SavedSuccessfully);
                }
                else
                {
                    record.UpdateAuditInfo(0);
                    await this.seoDetailServices.UpdateAsync(record);

                    this.ShowMessage(Messages.UpdateSuccessfully);
                }

                return(this.RedirectToRoute(Constants.RouteArea, new { controller = "seodetail", action = "manage", area = Constants.AreaAdmin, pageType = model.PageType }));
            }

            return(this.View(model));
        }
Exemple #2
0
        public async Task <PartialViewResult> GetDetail(string pageType, string pageId)
        {
            var model = new SeoDetailViewModel();

            var result = await this.seoDetailServices.GetByIdAsync(pageType, pageId);

            if (result != null)
            {
                model = this.Mapper.Map <SeoDetailViewModel>(result);
            }

            model.PageId   = pageId;
            model.PageType = pageType;

            return(this.PartialView("_SeoDetail", model));
        }