protected override ValidationResult IsValid(object value, ValidationContext validationContext)
        {
            NewItem item = (NewItem)validationContext.ObjectInstance;

            if (DateTime.Compare(item.CreationDate, DateTime.Now) > 0)
            {
                return(new ValidationResult(GetErrorMessage()));
            }
            return(ValidationResult.Success);
        }
Exemple #2
0
        public Task <Item> CreateItem(Guid id, NewItem item, DateTime creationdate)
        {
            Item   tempitem     = new Item();
            Random random       = new Random();
            int    randomNumber = random.Next(1, 100);

            tempitem.ItemId       = Guid.NewGuid();
            tempitem.ItemLevel    = item.ItemLevel;
            tempitem.ItemType     = item.ItemType;
            tempitem.CreationDate = item.CreationDate;

            return(_repository.CreateItem(id, tempitem, creationdate));
        }
 public Task <Item> CreateItem(Guid id, [FromBody] NewItem item, [FromBody] DateTime creationdate)
 {
     return(_processor.CreateItem(id, item, creationdate));
 }