public UniqueIdType Add(UniqueIdType uniqueIdType) { _context.UniqueIdTypes.Add(uniqueIdType); _context.SaveChanges(); return(uniqueIdType); }
public UniqueIdType Update(UniqueIdType idChanges) { var uniqueid = _context.UniqueIdTypes.Attach(idChanges); uniqueid.State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(idChanges); }
public ActionResult Put(int id, [FromBody] UniqueIdType uniqueIdType) { if (id > 0) { uid.Update(uniqueIdType); return(Ok("Id Details Updated")); } return(NotFound()); }
public UniqueIdType Delete(int id) { UniqueIdType uniqueIdType = _context.UniqueIdTypes.Find(id); if (uniqueIdType != null) { _context.UniqueIdTypes.Remove(uniqueIdType); _context.SaveChanges(); } return(uniqueIdType); }
public static string CreateUniqueId(UniqueIdType idType) { Int32 attempts = 0; string returnValue = String.Empty; try { do { attempts++; returnValue = Guid.NewGuid().ToString(); if (idType == UniqueIdType.OrganizationUniqueId) { OrganizationCollection ecCustomerCollection = new OrganizationCollection(); PredicateExpression filter = new PredicateExpression(OrganizationFields.UniqueIdentifier == returnValue); ecCustomerCollection.GetMulti(filter); if (ecCustomerCollection.Count == 0) { break; } } else if (idType == UniqueIdType.DeviceUniqueId) { DeviceCollection ecDeviceCollection = new DeviceCollection(); PredicateExpression filter = new PredicateExpression(DeviceFields.UniqueIdentifier == returnValue); ecDeviceCollection.GetMulti(filter); if (ecDeviceCollection.Count == 0) { break; } } else if (idType == UniqueIdType.LocationUniqueId) { LocationCollection ecCustomerLocationCollection = new LocationCollection(); PredicateExpression filter = new PredicateExpression(LocationFields.UniqueIdentifier == returnValue); ecCustomerLocationCollection.GetMulti(filter); if (ecCustomerLocationCollection.Count == 0) { break; } } } while (attempts < GlobalSettings.MAX_KEYGEN_ATTEMPTS); return(returnValue); } catch (Exception ex) { Loggers.LogException(GlobalSettings.SYSTEM_DAEMON_USER_ID, ex); return(returnValue); } }
public PatientDTO AddPatient(PatientDTO PatientDTO) { var Patients = new Patient() { PatientName = PatientDTO.PatientName, Age = PatientDTO.Age, Gender = PatientDTO.Gender, PhoneNumber = PatientDTO.PhoneNumber, Loginid = PatientDTO.Loginid }; _context.Patients.Add(Patients); _context.SaveChanges(); int Patientid = Patients.PatientId; PatientAddress addr = new PatientAddress() { StreetNumber = PatientDTO.StreetNumber, Area = PatientDTO.Area, City = PatientDTO.City, State = PatientDTO.State, Country = PatientDTO.Country, ZipCode = PatientDTO.ZipCode, Patientid = Patientid }; _context.PatientAddresses.Add(addr); _context.SaveChanges(); var uid = new UniqueIdType() { UniqueidType = PatientDTO.UniqueIdType, UniqueidNumber = PatientDTO.UniqueidNumber, Patientid = Patientid }; _context.UniqueIdTypes.Add(uid); _context.SaveChanges(); PatientDTO.PatientId = Patientid; return(PatientDTO); }
public ActionResult Post([FromBody] UniqueIdType uniqueIdType) { uid.Add(uniqueIdType); return(Ok()); }