//********************************************************************************** //********************************************************************************** //********************************************************************************** //EJEMPLOS public User Login() { DataTable dt = WikiDBAdapter.GetDataTable("GetNewsConfiguration"); User user = new User(); if (dt != null && dt.Rows.Count > 0) { var dsm = new DataSetMapper <User>(); user = dsm.ConvertSingleFromBackend(dt.Rows[0]); } return(user); }
public bool IsUserOwnerComent(Coment coment, User user) { DataAccessParameter[] parameters = new DataAccessParameter[2]; parameters[0] = new DataAccessParameter("@ComentId", coment.ComentId, typeof(int), null, ParameterDirection.Input); parameters[1] = new DataAccessParameter("@UserId", user.UserId, typeof(int), null, ParameterDirection.Input); DataTable dt = WikiDBAdapter.GetDataTable("IsUserOwnerComent", parameters); bool result = false; if (dt != null && dt.Rows.Count > 0) { result = true; } return(result); }
public User GetUserByUserName(string userName) { DataAccessParameter[] parameters = new DataAccessParameter[1]; parameters[0] = new DataAccessParameter("@UserName", userName, typeof(string), null, ParameterDirection.Input); DataTable dt = WikiDBAdapter.GetDataTable("GetUserByUserName", parameters); User user = new User(); if (dt != null && dt.Rows.Count > 0) { var dsm = new DataSetMapper <User>(); user = dsm.ConvertSingleFromBackend(dt.Rows[0]); } return(user); }
/// <summary> /// Obtiene la información de un post por id /// </summary> /// <param name="post">Post con el id</param> /// <returns></returns> public Post GetPostById(Post post) { DataAccessParameter[] parameters = new DataAccessParameter[1]; parameters[0] = new DataAccessParameter("@PostId", post.PostId, typeof(int), null, ParameterDirection.Input); DataTable dt = WikiDBAdapter.GetDataTable("GetPostById", parameters); Post result = new Post(); if (dt != null && dt.Rows.Count > 0) { var dsm = new DataSetMapper <Post>(); result = dsm.ConvertSingleFromBackend(dt.Rows[0]); } return(result); }