示例#1
0
        public ActionResult BeerTypes_Create([DataSourceRequest]DataSourceRequest request, AdminBeerTypeRequestViewModel beerType)
        {
            var newId = 0;

            if (this.ModelState.IsValid)
            {
                var entity = this.Mapper.Map<BeerType>(beerType);

                newId = this.beerTypes.AdminCreate(entity);
            }

            var newBeerType = this.beerTypes.GetByIntId(newId);
            var beerTypeToDisplay = this.Mapper.Map<AdminBeerTypeViewModel>(newBeerType);

            return this.Json(new[] { beerTypeToDisplay }.ToDataSourceResult(request, this.ModelState));
        }
示例#2
0
        public ActionResult BeerTypes_Create([DataSourceRequest] DataSourceRequest request, AdminBeerTypeRequestViewModel beerType)
        {
            var newId = 0;

            if (this.ModelState.IsValid)
            {
                var entity = this.Mapper.Map <BeerType>(beerType);

                newId = this.beerTypes.AdminCreate(entity);
            }

            var newBeerType       = this.beerTypes.GetByIntId(newId);
            var beerTypeToDisplay = this.Mapper.Map <AdminBeerTypeViewModel>(newBeerType);

            return(this.Json(new[] { beerTypeToDisplay }.ToDataSourceResult(request, this.ModelState)));
        }