Example #1
0
        /// <summary>
        /// Insert a module object
        /// </summary>
        public Module Create(string description, string module, DateTime createdDate, Guid createdBy, DateTime modifiedDate, Guid modifiedBy)
        {
            var moduleEntity = new Module();

            try
            {
                moduleEntity.Description = description;
                moduleEntity._Module = module;
                moduleEntity.Audit = new AuditComponent()
                {
                    CreatedDate = createdDate,
                    CreatedById = createdBy,
                    LastModifiedDate = modifiedDate,
                    LastModifiedById = modifiedBy
                };

                moduleRepo.DbContext.BeginTransaction();
                moduleRepo.SaveOrUpdate(moduleEntity);
                moduleRepo.DbContext.CommitTransaction();

                return moduleEntity;
            }
            catch (Exception ex)
            {
                LogManager.LogException(ex);
                return new Module();
            }
        }
Example #2
0
        /// <summary>
        /// Delete a module
        /// </summary>
        public bool Delete(Module module,Guid userId)
        {
            try
            {
                moduleRepo.DbContext.BeginTransaction();

                module.Audit.IsDeleted = true;
                module.Audit.LastModifiedDate = DateTime.Now;
                module.Audit.LastModifiedById = userId;

                moduleRepo.SaveOrUpdate(module);
                moduleRepo.DbContext.CommitTransaction();
                return true;
            }
            catch (Exception ex)
            {
                LogManager.LogException(ex);
                return false;
            }
        }