public JsonMessageStatus alterarStatus(int id) { var retorno = new JsonMessageStatus(); var Objeto = this.carregar(id); if (Objeto == null) { retorno.error = true; retorno.message = NotificationMessages.invalid_register_id; } else { Objeto.ativo = (Objeto.ativo == "S" ? "N" : "S"); db.SaveChanges(); retorno.active = Objeto.ativo; retorno.message = "Os dados foram alterados com sucesso."; } return(retorno); }
//Alteracao de status public JsonMessageStatus alterarStatus(int id) { var retorno = new JsonMessageStatus(); var item = this.carregar(id); if (item == null) { retorno.error = true; retorno.message = NotificationMessages.invalid_register_id; } else { item.ativo = (item.ativo == "S" ? "N" : "S"); db.SaveChanges(); retorno.active = item.ativo; retorno.message = NotificationMessages.updateSuccess; } return(retorno); }
//Alteracao de status public JsonMessageStatus alterarStatus(int id) { var retorno = new JsonMessageStatus(); var item = db.ProdutoItem.condicoesSeguranca().FirstOrDefault(x => x.id == id); if (item == null) { retorno.error = true; retorno.message = NotificationMessages.invalid_register_id; } else { item.ativo = (item.ativo != true); db.SaveChanges(); retorno.active = item.ativo == true ? "S" : "N"; retorno.message = NotificationMessages.updateSuccess; } return(retorno); }
//Alteracao de status public JsonMessageStatus alterarStatus(int id) { var retorno = new JsonMessageStatus(); var item = db.Representante.FirstOrDefault(x => x.id == id && x.dtExclusao == null); if (item == null) { retorno.error = true; retorno.message = NotificationMessages.invalid_register_id; } else { item.ativo = (item.ativo != true); db.SaveChanges(); retorno.active = item.ativo == true ? "S" : "N"; retorno.message = NotificationMessages.updateSuccess; } return(retorno); }
// public override JsonMessageStatus excluir(int id) { var ORetorno = new JsonMessageStatus(); var OArquivo = this.carregar(id); if (OArquivo == null) { ORetorno.error = true; ORetorno.message = "O arquivo informado não foi encontrado;"; return(ORetorno); } ORetorno = base.excluir(id); if (ORetorno.error) { return(ORetorno); } var listaArquivos = this.listar(OArquivo.idReferenciaEntidade, OArquivo.entidade, "") .Where(x => x.id != id).OrderBy(x => x.ordem).ToList(); byte cont = 1; listaArquivos.ForEach(x => { x.ordem = cont; cont++; }); db.SaveChanges(); ORetorno.error = false; return(ORetorno); }
public JsonMessageStatus alterarStatus(int id) { var Retorno = new JsonMessageStatus(); var item = db.ConfiguracaoPromocao.Find(id); if (item == null) { Retorno.error = true; Retorno.message = NotificationMessages.invalid_register_id; } else { item.ativo = !item.ativo; db.SaveChanges(); Retorno.error = false; Retorno.active = item.ativo ? "S" : "N"; Retorno.message = NotificationMessages.updateSuccess; } return(Retorno); }