Ejemplo n.º 1
0
 public TagEntity Add(TagEntity t)
 {
     tag tag = new tag();
     Mapper.Map(t, tag);
     using (this.mEntities = new photoshareEntities())
     {
         tag existingTag = this.mEntities.tags.FirstOrDefault(x => x.Name.ToUpper() == t.Name.ToUpper() && x.Type == t.Type && x.ParentId == t.ParentId);
         if (existingTag == null)
         {
             this.mEntities.tags.AddObject(tag);
             this.mEntities.SaveChanges();
         }
     }
     return t;
 }
 /// <summary>
 /// Deprecated Method for adding a new object to the tags EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotags(tag tag)
 {
     base.AddObject("tags", tag);
 }
 /// <summary>
 /// Create a new tag object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="date">Initial value of the Date property.</param>
 /// <param name="owner">Initial value of the Owner property.</param>
 /// <param name="parentId">Initial value of the ParentId property.</param>
 /// <param name="type">Initial value of the Type property.</param>
 /// <param name="isCategory">Initial value of the IsCategory property.</param>
 public static tag Createtag(global::System.Guid id, global::System.String name, global::System.DateTime date, global::System.Guid owner, global::System.Guid parentId, global::System.String type, global::System.Boolean isCategory)
 {
     tag tag = new tag();
     tag.Id = id;
     tag.Name = name;
     tag.Date = date;
     tag.Owner = owner;
     tag.ParentId = parentId;
     tag.Type = type;
     tag.IsCategory = isCategory;
     return tag;
 }