Exemple #1
0
        public async System.Threading.Tasks.Task <ActionResult> Add(Models.BrandDetailVM model)
        {
            if (ModelState.IsValid)
            {
                var brand = new Data.Models.Entities.Brand
                {
                    BrandName   = model.Name,
                    Description = model.Description,
                };
                await this.brandService.CreateAsync(brand);

                return(this.RedirectToAction("Index"));
            }
            return(View("Form", model));
        }
        public async System.Threading.Tasks.Task <ActionResult> Add(Models.BrandDetailVM model)
        {
            if (ModelState.IsValid)
            {
                var brand = new Data.Models.Entities.Brand
                {
                    BrandName   = model.Name,
                    Description = model.Description,
                    isActive    = model.isActive
                };
                await this.brandService.CreateAsync(brand);

                //return this.RedirectToAction("Index");
                Session.Clear();
                Session["ADD_RESULT"] = true;
                return(new ContentResult
                {
                    Content = string.Format("<script type='text/javascript'>window.parent.location.href = '{0}';</script>", Url.Action("Index", "Brand")),
                    ContentType = "text/html"
                });
            }
            return(View("Form", model));
        }