コード例 #1
0
        public async Task <string> GetWifeName(OrphanageDataModel.Persons.Father father)
        {
            _logger.Information($"Trying to get wife name for the father {father.Name.FullName()}");
            string WifeName = "";

            foreach (var fam in father.Families)
            {
                if (fam.Mother == null || fam.Mother.Name == null)
                {
                    _logger.Information($"Trying to get mother object for the father {father.Name.FullName()}");
                    fam.Mother = await _motherDbService.GetMother(fam.MotherId);
                }
                if (father.Families.Count > 1)
                {
                    WifeName += fam.Mother.Name.FullName() + ", ";
                }
                else
                {
                    WifeName += fam.Mother.Name.FullName() + ", ";
                }
            }
            if (WifeName.EndsWith(", "))
            {
                WifeName = WifeName.Substring(0, WifeName.Length - 2);
            }
            _logger.Information($"wife name for the father {father.Name.FullName()}, is {WifeName}");
            return(WifeName);
        }
コード例 #2
0
        public async Task <OrphanageDataModel.Persons.Mother> Get(int id)
        {
            var ret = await _MotherDBService.GetMother(id);

            if (ret == null)
            {
                throw new HttpResponseException(System.Net.HttpStatusCode.NotFound);
            }
            else
            {
                return(ret);
            }
        }