private PatientModel ConvertEntityToModelConcise(patient entity) { if (entity == null) { return(null); } var model = new PatientModel() { Id = entity.id, LastName = entity.lastName, FirstName = entity.firstName, Zehut = entity.zehut.Trim(), OpenDate = entity.openDate == null || entity.openDate == default(DateTime) ? (DateTime?)null : Convert.ToDateTime(entity.openDate), OpenDateYear = entity.openDate == null ? -1 : Convert.ToDateTime(entity.openDate).Year, OpenDateMonth = entity.openDate == null ? -1 : Convert.ToDateTime(entity.openDate).Month, OpenDateDay = entity.openDate == null ? -1 : Convert.ToDateTime(entity.openDate).Day, IsCurrent = entity.isCurrent, Branch = entity.branch == null ? new BranchModelConcise() : new BranchModelConcise { Id = entity.branch.id, Name = entity.branch.name.Trim() }, City = entity.city == null ? new CityModelConcise() : new CityModelConcise { Id = entity.city.id, Name = entity.city.name.Trim() }, }; model.Name = model.GetName(); return(model); }
public PatientModel ConvertEntityToModel(patient entity) { if (entity == null) { return(null); } var model = new PatientModel() { Id = entity.id, LastName = entity.lastName, FirstName = entity.firstName, Zehut = entity.zehut.Trim(), OpenDate = entity.openDate == null || entity.openDate == default(DateTime) ? (DateTime?)null : Convert.ToDateTime(entity.openDate), OpenDateYear = entity.openDate == null ? -1 : Convert.ToDateTime(entity.openDate).Year, OpenDateMonth = entity.openDate == null ? -1 : Convert.ToDateTime(entity.openDate).Month, OpenDateDay = entity.openDate == null ? -1 : Convert.ToDateTime(entity.openDate).Day, Dob = entity.dob, DobYear = entity.dob == null ? -1 : Convert.ToDateTime(entity.dob).Year, DobMonth = entity.dob == null ? -1 : Convert.ToDateTime(entity.dob).Month, DobDay = entity.dob == null ? -1 : Convert.ToDateTime(entity.dob).Day, YearOfBirth = entity.dob == null ? (int?)null : Convert.ToDateTime(entity.dob).Year, Street = entity.street, HouseNumber = entity.houseNumber == null ? null : entity.houseNumber.Trim(), ApartmentNumber = entity.apartmentNumber, ZipCode = entity.zipCode, EmailAddress = entity.emailAddress, Notes = entity.notes, NotesRtf = entity.notesRtf, IsCurrent = entity.isCurrent, Branch = entity.branch == null ? new BranchModelConcise() : new BranchModelConcise { Id = entity.branch.id, Name = entity.branch.name.Trim() }, ReferredByType = entity.referredByType == null ? new ReferredByTypeModelConcise() : new ReferredByTypeModelConcise { Id = entity.referredByType.id, Name = entity.referredByType.name.Trim() }, Kupah = entity.kupah == null ? new KupahModelConcise() : new KupahModelConcise { Id = entity.kupah.id, Name = entity.kupah.name.Trim() }, City = entity.city == null ? new CityModelConcise() : new CityModelConcise { Id = entity.city.id, Name = entity.city.name.Trim() }, Gender = entity.gender == null ? null : new GenderModel { Id = entity.gender.id, Name = entity.gender.name.Trim() }, }; model.Name = model.GetName(); //Dob = entity.dob == null ? (DateTime?)null : Convert.ToDateTime(entity.dob), return(model); }