コード例 #1
0
        /// <summary>
        /// Saves the provided entity.
        /// Note: PrepareSave must be called before using this function.
        /// </summary>
        /// <returns></returns>
        public virtual bool Save(IEntity entity)
        {
            bool success = false;

            using (LogGroup logGroup = LogGroup.Start("Saving the provided entity.", NLog.LogLevel.Debug))
            {
                if (Page.IsValid)
                {
                    success = CreateController.Save(entity);
                }
            }
            return(success);
        }
コード例 #2
0
        /// <summary>
        /// Saves the entity from the form.
        /// </summary>
        /// <returns></returns>
        public virtual bool Save()
        {
            bool success = false;

            using (LogGroup logGroup = LogGroup.Start("Saving the entity from the form.", NLog.LogLevel.Debug))
            {
                if (Page.IsValid)
                {
                    PrepareSave();

                    if (DataSource == null)
                    {
                        throw new Exception("DataSource == null. Call PrepareSave().");
                    }

                    success = CreateController.Save(DataSource);
                }
            }
            return(success);
        }