func (c *BundleControllerWithValidation) CheckNotFound() revel.Result { bundleIdStr := c.Params.Get("bundleId") c.Validation.Required(bundleIdStr).Message("BundleId is required.") if c.Validation.HasErrors() { c.Validation.Keep() c.FlashParams() return c.Redirect(routes.AlphaWingController.Index()) } bundleId, err := strconv.Atoi(bundleIdStr) if err != nil { c.Flash.Error("BundleId is invalid.") return c.Redirect(routes.AlphaWingController.Index()) } bundle, err := models.GetBundle(Dbm, bundleId) if err != nil { if err == sql.ErrNoRows { return c.NotFound("Bundle is not found.") } panic(err) } c.Bundle = bundle return nil }
func (c *LimitedTimeController) CheckNotFound() revel.Result { bundleIdStr := c.Params.Get("bundleId") c.Validation.Required(bundleIdStr) if c.Validation.HasErrors() { revel.ERROR.Printf("BundleId is required.") return c.NotFound("") } bundleId, err := strconv.Atoi(bundleIdStr) if err != nil { revel.ERROR.Printf(err.Error()) return c.NotFound("") } bundle, err := models.GetBundle(Dbm, bundleId) if err != nil { if err == sql.ErrNoRows { revel.ERROR.Printf("Bundle is not found.") } else { revel.ERROR.Printf(err.Error()) } return c.NotFound("") } c.Bundle = bundle return nil }