コード例 #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
ファイル: Remover.cs プロジェクト: thabet-fix/ndoctor
 /// <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
ファイル: Updator.cs プロジェクト: thabet-fix/ndoctor
        /// <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);
        }