public void IsValid_Doctor() { var item = new DoctorDto() { FirstName = Guid.NewGuid().ToString(), LastName = Guid.NewGuid().ToString(), }; Assert.IsTrue(item.IsValid()); }
public void IsInvalid_Doctor() { var item = new DoctorDto() { FirstName = string.Empty, LastName = string.Empty, }; Assert.IsFalse(item.IsValid()); }
/// <summary> /// Create the specified item into the database /// </summary> /// <param name="doctor"></param> /// <returns></returns> public long Create(DoctorDto doctor) { return new Creator(this.Session).Create(doctor); }
/// <summary> /// Updates the specified doctor. /// </summary> /// <param name="item">The item.</param> public void Update(DoctorDto item) { new Updator(this.Session).Update(item); }
/// <summary> /// Removes the specified doctor. /// </summary> /// <param name="item">The item.</param> public void Remove(DoctorDto item) { new Remover(this.Session).Remove(item); }
/// <summary> /// Determines whether the specified doctor 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(DoctorDto item) { return new Remover(this.Session).CanRemove(item); }
/// <summary> /// Create the specified item into the database /// </summary> /// <param name="item"></param> /// <returns></returns> public long Create(DoctorDto item) { Assert.IsNotNull(item, "item"); var found = (from p in this.Session.Query<Doctor>() where p.Id == item.Id || (item.FirstName.ToUpper() == p.FirstName.ToUpper() && item.LastName.ToUpper() == p.LastName.ToUpper()) select p).ToList().Count() > 0; if (found) throw new ExistingItemException(); var entity = Mapper.Map<DoctorDto, Doctor>(item); item.Id = (long)this.Session.Save(entity); return item.Id; }
public static void SetDoctor(DependencyObject target, DoctorDto value) { target.SetValue(DoctorProperty, value); }