示例#1
0
        public Hospital CreateHospital(Hospital entity)
        {
            //Check

            if (_repoHospital.ExistHospital(x => x.Code == entity.Code || x.Name == entity.Name))
            {
                throw new BusinessException($"已经存在同名或者代码(Code)相同的医院!Code = <{entity.Code}> , Name = <{entity.Name}>");
            }
            //entity.Id = Guid.NewGuid().ToString();

            //foreach (var materialDemand in entity.MaterialDemands)
            //{
            //    materialDemand.Id = Guid.NewGuid().ToString();
            //}
            //foreach (var contact in entity.Contacts)
            //{
            //    contact.Id = Guid.NewGuid().ToString();
            //}
            return(_repoHospital.CreateHospital(entity));
        }