12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using System;
- using System.ComponentModel;
- using System.ComponentModel.DataAnnotations;
- namespace HyperCube.Models
- {
- public enum ArticleStatus {
- [Display(Name = "Новая")]
- New = 0,
- [Display(Name = "Добавлена")]
- Added,
- [Display(Name = "Отредактирована")]
- Edited,
- [Display(Name = "Проверена")]
- Verified,
- [Display(Name = "Отклонена")]
- Rejected,
- [Display(Name = "Удалена")]
- Deleted }
- public class ArticleModel : ICloneable
- {
- public string Filename { get; set; }
- [Required]
- public string Name { get; set; }
- [Required]
- public DateTime PublishDate { get; set; } = DateTime.Now.Date;
- [Required]
- public string Authors { get; set; }
- [Required]
- public string Keywords { get; set; }
- [Required]
- public string Annotation { get; set; }
- public string Text { get; set; }
- public ArticleStatus Status { get; set; } = ArticleStatus.New;
- [Required]
- public int? Rating
- {
- get { return rating; }
- set
- {
- rating = value;
- if (rating < 1) rating = 1;
- if (rating > 5) rating = 5;
- }
- }
- private int? rating;
- public object Clone()
- {
- return MemberwiseClone();
- }
- }
- }
|