Exemple #1
0
 public TEntity GetEntity(string id)
 {
     try
     {
         DbModel.Location.AreaAndDev.Post post = dbSet.FindById(int.Parse(id));
         return(post.ToTModel());
     }
     catch (Exception ex)
     {
         Log.Error("getPostById:" + id + ";" + ex.ToString());
         return(null);
     }
 }
Exemple #2
0
 public TEntity Post(TEntity item)
 {
     try
     {
         DbModel.Location.AreaAndDev.Post post = item.ToDbModel();
         var result = dbSet.Add(post);
         return(result ? post.ToTModel() : null);
     }
     catch (Exception ex)
     {
         Log.Error("AddPost:" + ex.ToString());
         return(null);
     }
 }
Exemple #3
0
 public TEntity Delete(string id)
 {
     try
     {
         int keyId = int.Parse(id);
         DbModel.Location.AreaAndDev.Post post = dbSet.DeleteById(keyId);
         return(post.ToTModel());
     }
     catch (Exception ex)
     {
         Log.Error("deletePost:" + id + ex.ToString());
         return(null);
     }
 }