Beispiel #1
0
        private Lab GetLab(CorporateCustomerEditModel model, OrganizationRoleUser createdByOrgRoleUser, IEnumerable <Lab> labs)
        {
            Lab lab = null;

            if (!string.IsNullOrEmpty(model.Lab))
            {
                lab = labs.FirstOrDefault(l => l.Name.Trim().ToLower() == model.Lab.Trim().ToLower());
                if (lab == null)
                {
                    lab = _labRepository.GetByName(model.Lab);
                    if (lab == null)
                    {
                        lab = new Lab
                        {
                            Name     = model.Lab,
                            Alias    = model.Lab,
                            IsActive = true,
                            CreatedByOrgRoleUserId = createdByOrgRoleUser.Id,
                            DateCreated            = DateTime.Now
                        };

                        lab = _labRepository.Save(lab);
                    }
                }
            }

            return(lab);
        }