public string GetById(int id) { using (RepositoryBase repository = new RepositoryBase()) { Sts_maquina sts_maquina = (Sts_maquina)repository.GetById(typeof(Sts_maquina), id); return(JsonConvert.SerializeObject(sts_maquina)); } }
public string Delete(int id) { using (RepositoryBase repository = new RepositoryBase()) { try { repository.BeginTransaction(); Sts_maquina sts_maquina = (Sts_maquina)repository.GetById(typeof(Sts_maquina), id); repository.Delete(sts_maquina); return(JsonConvert.SerializeObject(sts_maquina)); } catch { repository.RollbackTransaction(); return("Erro"); } } }
public string Save(string json) { using (RepositoryBase repository = new RepositoryBase()) { try { repository.BeginTransaction(); Sts_maquina sts_maquina = JsonConvert.DeserializeObject <Sts_maquina>(json); repository.Save(sts_maquina); return(JsonConvert.SerializeObject(sts_maquina)); } catch { repository.RollbackTransaction(); return("Erro"); } } }