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