コード例 #1
0
 public void IsValid()
 {
     var item = new ReputationDto()
     {
         Name = Guid.NewGuid().ToString(),
     };
     Assert.IsTrue(item.IsValid());
 }
コード例 #2
0
 public void IsInvalid()
 {
     var item = new ReputationDto()
     {
         Name = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
コード例 #3
0
 /// <summary>
 /// Create the specified item into the database
 /// </summary>
 /// <param name="reputation">The item to add in the database</param>
 public long Create(ReputationDto reputation)
 {
     return new Creator(this.Session).Create(reputation);
 }
コード例 #4
0
 public static void SetReputation(DependencyObject target, ReputationDto value)
 {
     target.SetValue(ReputationProperty, value);
 }
コード例 #5
0
 /// <summary>
 /// Updates the specified reputation.
 /// </summary>
 /// <param name="reputation">The tag.</param>
 public void Update(ReputationDto reputation)
 {
     new Updator(this.Session).Update(reputation);
 }
コード例 #6
0
        public void Remove(ReputationDto item)
        {
            var remover = new Remover(this.Session);

            if (remover.CanRemove(item)) { remover.Remove<Reputation>(item); }
        }
コード例 #7
0
 /// <summary>
 /// Determines whether this instance can remove the specified reputation dto.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///   <c>true</c> if this instance can remove the specified reputation dto; otherwise, <c>false</c>.
 /// </returns>
 public bool CanRemove(ReputationDto item)
 {
     return new Remover(this.Session).CanRemove(item);
 }
コード例 #8
0
ファイル: Creator.cs プロジェクト: seniorOtaka/ndoctor
        /// <summary>
        /// Create the specified item into the database
        /// </summary>
        /// <param name="item">The item to add in the database</param>
        public long Create(ReputationDto item)
        {
            Assert.IsNotNull(item, "item");

            var exist = (from p in this.Session.Query<Reputation>()
                         where item.Name.ToUpper() == p.Name.ToUpper()
                         || p.Id == item.Id
                         select p).ToList().Count() > 0;
            if (exist) throw new ExistingItemException();

            var entity = Mapper.Map<ReputationDto, Reputation>(item);

            item.Id = (long)this.Session.Save(entity);
            return item.Id;
        }