public void Remove(ReputationDto item) { var remover = new Remover(this.Session); if (remover.CanRemove(item)) { remover.Remove <Reputation>(item); } }
public void IsValid() { var item = new ReputationDto() { Name = Guid.NewGuid().ToString(), }; Assert.IsTrue(item.IsValid()); }
public void IsInvalid() { var item = new ReputationDto() { Name = string.Empty, }; Assert.IsFalse(item.IsValid()); }
/// <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); }
/// <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); }
/// <summary> /// Updates the specified reputation. /// </summary> /// <param name="reputation">The tag.</param> public void Update(ReputationDto reputation) { new Updator(this.Session).Update(reputation); }
/// <summary> /// Creates the specified reputation. /// </summary> /// <param name="reputation">The tag.</param> public long Create(ReputationDto reputation) { return(new Creator(this.Session).Create(reputation)); }
/// <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)); }
public static void SetReputation(DependencyObject target, ReputationDto value) { target.SetValue(ReputationProperty, value); }
/// <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); }