コード例 #1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="templateID"></param>
        /// <returns></returns>
        public OperationResult<OperationResults, CuratedGallery> CreateGallery(string name, int? templateID = null)
        {
            var rslt = new OperationResult<OperationResults, CuratedGallery>();

            using (var context = this.CreateMainContext())
            {
                var template = templateID.HasValue ? context.GalleryTemplateRecords.Where(x => x.ID == templateID.Value).SingleOrDefault() :
                    context.GalleryTemplateRecords.Where(x => x.IsDefault).SingleOrDefault();

                if (template == null)
                    throw new Exception("Template was not found");

                var gallery = new CuratedGalleryRecord()
                {
                    DateCreated = DateTime.UtcNow,
                    Enabled = true,
                    Name = name,
                    TemplateID = template.ID,
                    StatusID = (int)CuratedGalleryStatuses.UnPublished
                };

                context.CuratedGalleryRecords.InsertOnSubmit(gallery);
                context.SubmitChanges();

                rslt.Result = OperationResults.Success;
                rslt.Output = this.ObjectMapper.DoMapping<CuratedGallery>(gallery);
            }

            return rslt;
        }
コード例 #2
0
		private void detach_CuratedGalleryRecords(CuratedGalleryRecord entity)
		{
			this.SendPropertyChanging();
			entity.CuratedGalleryStatusRecord = null;
		}
コード例 #3
0
		private void attach_CuratedGalleryRecords(CuratedGalleryRecord entity)
		{
			this.SendPropertyChanging();
			entity.GalleryTemplateRecord = this;
		}
コード例 #4
0
 partial void DeleteCuratedGalleryRecord(CuratedGalleryRecord instance);
コード例 #5
0
 partial void UpdateCuratedGalleryRecord(CuratedGalleryRecord instance);
コード例 #6
0
 partial void InsertCuratedGalleryRecord(CuratedGalleryRecord instance);
コード例 #7
0
		private void detach_CuratedGalleryRecords(CuratedGalleryRecord entity)
		{
			this.SendPropertyChanging();
			entity.AdminUserMembershipRecord = null;
		}
コード例 #8
0
 protected CuratedGallery Convert(CuratedGalleryRecord record)
 {
     MappingData md = new MappingData(new string[] { Utils.GetPropertyName<CuratedGallery, AdminUserInfo>(x => x.Editor) });
     md.PropertiesMapping.Add(new MappingDataItem(Utils.GetPropertyName<CuratedGalleryRecord, short>(x => x.StatusID), Utils.GetPropertyName<CuratedGallery, CuratedGalleryStatuses>(x => x.Status), x => x.ToEnum<CuratedGalleryStatuses>()));
     md.PropertiesMapping.Add(new MappingDataItem(Utils.GetPropertyName<CuratedGalleryRecord, DateTime>(x => x.DateCreated), null, x => ((DateTime)x).ToLocalTime()));
     md.PropertiesMapping.Add(new MappingDataItem(Utils.GetPropertyName<CuratedGalleryRecord, DateTime?>(x => x.DateModified), null, x => (x == null ? (DateTime?)null : ((DateTime)x).ToLocalTime())));
     return this.ObjectMapper.DoMapping<CuratedGallery>(record, md);
 }