示例#1
0
        /// <summary>
        /// Removing the marler
        /// </summary>
        /// <param name="entity">marker to delete</param>
        public void Delete(DalMarker entity)
        {
            var marker = context.Set <Marker>().Where(c => c.Id == entity.Id).FirstOrDefault();

            if (marker != null)
            {
                context.Set <Marker>().Remove(marker);
            }
        }
示例#2
0
        /// <summary>
        /// Update information about marker
        /// </summary>
        /// <param name="entity">marker to update</param>
        public void Update(DalMarker entity)
        {
            var marker = context.Set <Marker>().Where(c => c.Id == entity.Id).FirstOrDefault();

            if (marker != null)
            {
                marker.Id        = entity.Id;
                marker.UserId    = entity.UserId;
                marker.ArticleId = entity.ArticleId;
            }
        }
示例#3
0
        /// <summary>
        /// Add the entry to database
        /// </summary>
        /// <param name="entity"></param>
        public void Create(DalMarker entity)
        {
            var marker = new Marker()
            {
                Id        = entity.Id,
                UserId    = entity.UserId,
                ArticleId = entity.ArticleId
            };

            context.Set <Marker>().Add(marker);
            context.SaveChanges();
        }
示例#4
0
 public static MarkerEntity ToBllMarker(this DalMarker dalMarker)
 {
     if (dalMarker != null)
     {
         return(new MarkerEntity()
         {
             Id = dalMarker.Id,
             UserId = dalMarker.UserId,
             ArticleId = dalMarker.ArticleId
         });
     }
     return(null);
 }