func (this *ServiceOperationController) Get() { id, err := this.GetInt64("sid", 0) if id == 0 { this.Data["json"] = "" this.ServeJSON() } operation := entity.Operation{} if err == nil { operation.Id = id err = operation.Load() if err == nil { this.Data["json"] = &operation this.ServeJSON() } else { this.Data["json"] = "" this.ServeJSON() } } }
func (this *ServiceOperationController) Post() { sid, _ := this.GetInt64("sid", 0) id, _ := this.GetInt64("id", 0) operation := entity.Operation{} operation.Id = id operation.Sid = sid operation.Start = this.GetString("start") operation.Restart = this.GetString("restart") operation.Stop = this.GetString("stop") if id == 0 { operation.Save() } else { operation.Update() } redirectUrl := fmt.Sprintf("templatesdetail?serviceId=%d", sid) this.Redirect(redirectUrl, 301) //this.Get() }