Exemplo n.º 1
0
 public void IsValid()
 {
     var item = new PracticeDto()
     {
         Name = Guid.NewGuid().ToString(),
     };
     Assert.IsTrue(item.IsValid());
 }
Exemplo n.º 2
0
        public void IsInvalid()
        {
            var item = new PracticeDto()
            {
                Name = string.Empty,
            };

            Assert.IsFalse(item.IsValid());
        }
Exemplo n.º 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(PracticeDto practice)
 {
     return new Creator(this.Session).Create(practice);
 }
 /// <summary>
 /// Determines whether the specified item can be removed.
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>
 ///   <c>true</c> if this instance can remove the specified item; otherwise, <c>false</c>.
 /// </returns>
 public bool CanRemove(PracticeDto item)
 {
     return new Remover(this.Session).CanRemove(item);
 }
 /// <summary>
 /// Updates the specified practice.
 /// </summary>
 /// <param name="practice">The drug.</param>
 public void Update(PracticeDto practice)
 {
     new Updator(this.Session).Update(practice);
 }
 /// <summary>
 /// Removes item with the specified id.
 /// </summary>
 /// <typeparam name="T">The type of the item to remove</typeparam>
 /// <param name="id">The id of the item to remove.</param>
 public void Remove(PracticeDto item)
 {
     new Remover(this.Session).Remove(item);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Create the specified item into the database
        /// </summary>
        /// <param name="reputation">The item to add in the database</param>
        public long Create(PracticeDto item)
        {
            Assert.IsNotNull(item, "item");

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

            var entity = Mapper.Map<PracticeDto, Practice>(item);

            item.Id = (long)this.Session.Save(entity);
            return item.Id;
        }
Exemplo n.º 8
0
 public static void SetPractice(DependencyObject target, PracticeDto value)
 {
     target.SetValue(PracticeProperty, value);
 }