Пример #1
0
        public OperatorInfo UpdateOperatorInfo(OperatorInfo update)
        {
            var operatorInfo = new OCM.Core.Data.Operator();

            if (update.ID > 1)
            {
                //existing operator
                operatorInfo = DataModel.Operators.FirstOrDefault(o => o.Id == update.ID);
            }

            operatorInfo.Title                 = update.Title;
            operatorInfo.WebsiteUrl            = update.WebsiteURL;
            operatorInfo.Comments              = update.Comments;
            operatorInfo.PhonePrimaryContact   = update.PhonePrimaryContact;
            operatorInfo.PhoneSecondaryContact = update.PhoneSecondaryContact;
            operatorInfo.IsPrivateIndividual   = update.IsPrivateIndividual;
            operatorInfo.IsRestrictedEdit      = update.IsRestrictedEdit;
            operatorInfo.BookingUrl            = update.BookingURL;
            operatorInfo.ContactEmail          = update.ContactEmail;
            operatorInfo.FaultReportEmail      = update.FaultReportEmail;

            if (operatorInfo.Id == 0)
            {
                //add new
                DataModel.Operators.Add(operatorInfo);
            }

            DataModel.SaveChanges();

            update = Model.Extensions.OperatorInfo.FromDataModel(operatorInfo);

            CacheManager.RefreshCachedData();

            return(update);
        }
Пример #2
0
        public OperatorInfo UpdateOperatorInfo(OperatorInfo update)
        {
            var operatorInfo = new OCM.Core.Data.Operator();
            if (update.ID > 1)
            {
                //existing operator
                operatorInfo = DataModel.Operators.FirstOrDefault(o => o.ID == update.ID);
            }

            operatorInfo.Title = update.Title;
            operatorInfo.WebsiteURL = update.WebsiteURL;
            operatorInfo.Comments = update.Comments;
            operatorInfo.PhonePrimaryContact = update.PhonePrimaryContact;
            operatorInfo.PhoneSecondaryContact = update.PhoneSecondaryContact;
            operatorInfo.IsPrivateIndividual = update.IsPrivateIndividual;
            operatorInfo.IsRestrictedEdit = update.IsRestrictedEdit;
            operatorInfo.BookingURL = update.BookingURL;
            operatorInfo.ContactEmail = update.ContactEmail;
            operatorInfo.FaultReportEmail = update.FaultReportEmail;

            if (operatorInfo.ID == 0)
            {
                //add new
                DataModel.Operators.Add(operatorInfo);
            }

            DataModel.SaveChanges();

            update = Model.Extensions.OperatorInfo.FromDataModel(operatorInfo);

            CacheManager.RefreshCachedData();

            return update;
        }