public static Phone CreateForAssociate(int phoneId, bool isPrimary, int associateId, Extension extension, PhoneTypeLookup phoneType) { return(new Phone { Id = phoneId, IsPrimary = isPrimary, AssociateId = associateId, Extension = extension, PhoneType = phoneType }); }
public static Phone CreateForContact(int phoneId, bool isPrimary, int contactId, Extension extension, PhoneTypeLookup phoneType) { return(new Phone { Id = phoneId, IsPrimary = isPrimary, ContactId = contactId, Extension = extension, PhoneType = phoneType }); }
/// <summary> /// Creates a address type /// </summary> /// <param name="phoneTypeModel"></param> /// <returns></returns> public int Create(PhoneTypeModel phoneTypeModel) { using (var scope = new TransactionScope()) { var phoneType = new PhoneTypeLookup() { PhoneType = phoneTypeModel.PhoneType, Archived = phoneTypeModel.Archived }; var phoneTypeCheck = _dbActions.PhoneTypeRepository.GetSingle(p => p.PhoneType == phoneTypeModel.PhoneType); if (phoneTypeCheck == null) { _dbActions.PhoneTypeRepository.Insert(phoneType); _dbActions.Save(); scope.Complete(); return(phoneType.Id); } scope.Complete(); return(-1); } }