/// <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); } }
/// <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; } }
/// <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(); }
public static MarkerEntity ToBllMarker(this DalMarker dalMarker) { if (dalMarker != null) { return(new MarkerEntity() { Id = dalMarker.Id, UserId = dalMarker.UserId, ArticleId = dalMarker.ArticleId }); } return(null); }