public static DTO.ChildWithFamilyDetails GetChildWithDetailsById(string childId) { DAL.Child child = new DAL.Child(); DAL.Family family = new DAL.Family(); DAL.City city = new DAL.City(); DAL.School school = new DAL.School(); child = context.Childs.FirstOrDefault(p => p.IdentityNum == childId); family = context.Families.FirstOrDefault(p => p.FamilyId == child.FamilyId); school = context.Schools.FirstOrDefault(p => p.SchoolId == child.SchoolId); city = context.Cities.FirstOrDefault(p => p.CityId == family.CityId); DTO.ChildWithFamilyDetails childWithDetails = new DTO.ChildWithFamilyDetails { IdentityNum = child.IdentityNum, FamilyId = child.FamilyId, FirstName = child.FirstName, FamilyName = family.FamilyName, FatherFirstName = family.FatherFirstName, MotherFirstName = family.MotherFirstName, NumOfChildren = family.NumOfChildren, CityId = family.CityId, Address = family.Address, Telephone = family.Telephone, Cellular1 = family.Cellular1, Cellular2 = family.Cellular2, Kind = child.Kind, BirthDate = child.BirthDate, PlaceInFamily = child.PlaceInFamily, SchoolId = child.SchoolId, Grade = child.Grade, JoiningDate = child.JoiningDate, ViturSodiutFrom = child.ViturSodiutFrom, PreviousCare = child.PreviousCare, Note = child.Note, IsActive = child.IsActive, IsMunicipality = child.IsMunicipality, sumAfterDiscount = child.sumAfterDiscount, SchoolName = school == null ? null : school.SchoolName, CityName = city == null ? null : city.CityName }; return(childWithDetails); }
/// <summary> /// find child /// </summary> /// <param name="child">the child that we whant to find</param> /// <remarks> /// accept child and send to FindChild(int? id) function with child id /// return true if find, else return false /// </remarks> public bool FindChild(Child child) { return(FindChild(child.ID) != null); }