예제 #1
0
        public void Remove(ReputationDto item)
        {
            var remover = new Remover(this.Session);

            if (remover.CanRemove(item))
            {
                remover.Remove <Reputation>(item);
            }
        }
예제 #2
0
        public void IsValid()
        {
            var item = new ReputationDto()
            {
                Name = Guid.NewGuid().ToString(),
            };

            Assert.IsTrue(item.IsValid());
        }
예제 #3
0
        public void IsInvalid()
        {
            var item = new ReputationDto()
            {
                Name = string.Empty,
            };

            Assert.IsFalse(item.IsValid());
        }
예제 #4
0
        /// <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);
        }
예제 #5
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((from t in this.Session.Query <Patient>()
             where t.Reputation.Id == item.Id
             select t).Count() == 0);
 }
예제 #6
0
 /// <summary>
 /// Updates the specified reputation.
 /// </summary>
 /// <param name="reputation">The tag.</param>
 public void Update(ReputationDto reputation)
 {
     new Updator(this.Session).Update(reputation);
 }
예제 #7
0
 /// <summary>
 /// Creates the specified reputation.
 /// </summary>
 /// <param name="reputation">The tag.</param>
 public long Create(ReputationDto reputation)
 {
     return(new Creator(this.Session).Create(reputation));
 }
예제 #8
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));
 }
예제 #9
0
 public static void SetReputation(DependencyObject target, ReputationDto value)
 {
     target.SetValue(ReputationProperty, value);
 }
예제 #10
0
        /// <summary>
        /// Updates the specified reputation.
        /// </summary>
        /// <param name="reputation">The tag.</param>
        public void Update(ReputationDto reputation)
        {
            var entity = Mapper.Map <ReputationDto, Reputation>(reputation);

            this.Session.Update(entity);
        }