public ActionResult Parar() { //se eu parar, preciso devolver o mesmo programa zerado main = LerArquivos.GetProgramaByName(main.nome); //se existir, converto o tempo para o ideal if (main != null) { main.tempo = main.convertTimer(main.tempo); } else { main = new Programa() { nome = "ProgramaPadrao", tempo = "120", potencia = "10", caracter = "#" }; } return(new JsonResult() { Data = new { result = main }, JsonRequestBehavior = JsonRequestBehavior.DenyGet }); }
public ActionResult IniciarPrograma(String nome) { if (main == null) { main = LerArquivos.GetProgramaByName(nome); main.tempo = main.convertTimer(main.tempo); return(this.Cozinhar(main)); } //verifica se é o mesmo programa if (main.paused && main.nome != null && main.nome.Equals(nome)) { return(this.Cozinhar(main)); } else { main = LerArquivos.GetProgramaByName(nome); main.tempo = main.convertTimer(main.tempo); } return(this.Cozinhar(main)); }