public async Task <DbStatus> Add(MedicalRecord medicalRecord) { var dbMedicalRecord = await GetByUniqueIdentifiers(new string[] { "Jmb" }, medicalRecord); DbCommand <MedicalRecord> commandToBeExecuted; if (dbMedicalRecord == null) { commandToBeExecuted = new InsertCommand <MedicalRecord>(); } else if (dbMedicalRecord.Deleted == 1) { commandToBeExecuted = new InsertOrUpdateCommand <MedicalRecord>(); } else { return(DbStatus.EXISTS); } return(await ServiceHelper <MedicalRecord> .ExecuteCRUDCommand(commandToBeExecuted, medicalRecord)); }
public async Task <DbStatus> Add(Place place) { var dbPlace = await GetByUniqueIdentifiers(new string[] { "Name", "CountryName", "PostalCode" }, place); DbCommand <Place> commandToBeExecuted; if (dbPlace == null) { commandToBeExecuted = new InsertCommand <Place>(); } else if (dbPlace.Deleted == 1) { commandToBeExecuted = new InsertOrUpdateCommand <Place>(); } else { return(DbStatus.EXISTS); } return(await ServiceHelper <Place> .ExecuteCRUDCommand(commandToBeExecuted, place)); }
public async Task <DbStatus> Add(Clinic clinic) { var dbClinic = await GetByUniqueIdentifiers(new string[] { "Name", "IdPlace" }, clinic); DbCommand <Clinic> commandToBeExecuted; if (dbClinic == null) { commandToBeExecuted = new InsertCommand <Clinic>(); } else if (dbClinic.Deleted == 1) { commandToBeExecuted = new InsertOrUpdateCommand <Clinic>(); } else { return(DbStatus.EXISTS); } return(await ServiceHelper <Clinic> .ExecuteCRUDCommand(commandToBeExecuted, clinic)); }
public async Task <DbStatus> Add(LocalAccountRole entity) { var dbLocalAccountRole = await GetByUniqueIdentifiers(new string[] { "IdRole", "IdLocalAccount" }, entity, null); DbCommand <LocalAccountRole> commandToBeExecuted; if (dbLocalAccountRole == null) { commandToBeExecuted = new InsertCommand <LocalAccountRole>(); } else if (dbLocalAccountRole.Deleted == 1) { commandToBeExecuted = new InsertOrUpdateCommand <LocalAccountRole>(); } else { return(DbStatus.EXISTS); } return(await ServiceHelper <LocalAccountRole> .ExecuteCRUDCommand(commandToBeExecuted, entity)); }
public async Task <DbStatus> Add(Role role) { var dbRole = await GetByUniqueIdentifiers(new string[] { "RoleName" }, role, null); DbCommand <Role> commandToBeExecuted; if (dbRole == null) { commandToBeExecuted = new InsertCommand <Role>(); } else if (dbRole.Deleted == 1) { commandToBeExecuted = new InsertOrUpdateCommand <Role>(); } else { return(DbStatus.EXISTS); } return(await ServiceHelper <Role> .ExecuteCRUDCommand(commandToBeExecuted, role)); }