public Response <FieldDefinition> CreateReferenceField([FromBody] ReferenceFields fields) { return(GetResponse(() => { return new EditorService(User).CreateReferenceField(fields.FieldA, fields.FieldB); })); }
private void SetValue(ReferenceFields field, string value) { switch (field) { case ReferenceFields.Unknown: break; case ReferenceFields.Id: Id = Convert.ToInt32(value); break; case ReferenceFields.Tag: Tag = value; break; case ReferenceFields.Type: Type = value.GetEnumValueOrDefault<ReferenceType>(); break; case ReferenceFields.Category: Category = value; break; case ReferenceFields.Relevance: Relevance = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.Authors: Authors = value; break; case ReferenceFields.Title: Title = value; break; case ReferenceFields.Magazine: Source = value; break; case ReferenceFields.Issue: Issue = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.Publisher: Publisher = value; break; case ReferenceFields.Edition: Edition = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.Volume: Volume = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.Pages: Pages = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.From: From = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.To: To = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.Isbn: Isbn = value; break; case ReferenceFields.Year: Year = value.IsNullOrEmpty() ? (int?) null : Convert.ToInt32(value); break; case ReferenceFields.SiteVisited: SiteVisited = (value.IsNullOrEmpty()) ? (DateTime?) null : DateTime.ParseExact(value, Constants.DateTimeFormat, CultureInfo.InvariantCulture); break; case ReferenceFields.Country: Country = value; break; case ReferenceFields.City: City = value; break; case ReferenceFields.Language: Language = value; break; case ReferenceFields.Url: Url = value.TrimEnd(new[] {'/'}); break; case ReferenceFields.Description: Description = value; break; default: throw new ArgumentOutOfRangeException("field"); } }
/// <summary> /// Initializes a new instance of the <see cref="Reference" /> class. /// </summary> public Reference() : base(CLASS_NAME) { mFields = new ReferenceFields(this); }