public void IsValid()
 {
     var item = new ProfessionDto()
     {
         Name = Guid.NewGuid().ToString(),
     };
     Assert.IsTrue(item.IsValid());
 }
 public void IsInvalid()
 {
     var item = new ProfessionDto()
     {
         Name = string.Empty,
     };
     Assert.IsFalse(item.IsValid());
 }
 /// <summary>
 /// Creates the specified profession.
 /// </summary>
 /// <param name="profession">The profession.</param>
 public long Create(ProfessionDto profession)
 {
     return new Creator(this.Session).Create(profession);
 }
 public static void SetProfession(DependencyObject target, ProfessionDto value)
 {
     target.SetValue(ProfessionProperty, value);
 }
 /// <summary>
 /// Updates the specified profession.
 /// </summary>
 /// <param name="profession">The tag.</param>
 public void Update(ProfessionDto profession)
 {
     new Updator(this.Session).Update(profession);
 }
        public void Remove(ProfessionDto item)
        {
            var remover = new Remover(this.Session);

            if (remover.CanRemove(item)) { remover.Remove<Profession>(item); }
        }
 public bool CanRemove(ProfessionDto item)
 {
     return new Remover(this.Session).CanRemove(item);
 }
Exemple #8
0
        /// <summary>
        /// Creates the specified profession.
        /// </summary>
        /// <param name="item">The profession.</param>
        /// <returns></returns>
        public long Create(ProfessionDto item)
        {
            Assert.IsNotNull(item, "item");

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

            var entity = Mapper.Map<ProfessionDto, Profession>(item);

            item.Id = (long)this.Session.Save(entity);
            return item.Id;
        }
 public Specification<LightPatientDto> ProfessionIs(ProfessionDto profession)
 {
     return new FindPatientByProfessionSpecification(profession);
 }