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)); }
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))); }