Пример #1
0
        private ICollection <TenantContact> CreateTenantContacts(Tenant tenant, ICollection <TenantContactViewModel> contacts)
        {
            if (contacts == null)
            {
                return(null);
            }

            var result = new List <TenantContact>();

            foreach (var contact in contacts)
            {
                var entity = new TenantContact
                {
                    Comments          = contact.Comments,
                    Created           = DateTime.Now,
                    MainContactNumber = contact.MainContactNumber,
                    Name                   = contact.Name,
                    Relationship           = contact.Relationship,
                    SecondaryContactNumber = contact.SecondaryContactNumber,
                    Tenant                 = tenant
                };

                result.Add(entity);
            }
            return(result);
        }
        public TenantContactViewModel(TenantContact contact)
        {
            if (contact == null)
            {
                return;
            }

            Id   = contact.Id;
            Name = contact.Name;
            MainContactNumber      = contact.MainContactNumber;
            SecondaryContactNumber = contact.SecondaryContactNumber;
            Relationship           = contact.Relationship;
            Comments = contact.Comments;
        }