Exemple #1
0
        public List <EN.UserComment> getComments(int userID)
        {
            List <EN.UserComment> list = new List <EN.UserComment>();

            try
            {
                var l2query = db.comments_users.Where(x => x.idClient == userID);

                foreach (var item in l2query)
                {
                    EN.UserComment itemEN = new EN.UserComment();
                    itemEN.IDComment = item.id;
                    itemEN.IDClient  = item.idClient;
                    itemEN.DateD     = item.date;
                    itemEN.Comment   = item.message;
                    itemEN.Value     = item.value;
                    list.Add(itemEN);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


            return(list);
        }
Exemple #2
0
        public bool createComment(EN.UserComment comments)
        {
            bool result = false;

            try
            {
                var datos = new DA.comments_users
                {
                    idClient = comments.IDClient,
                    message  = comments.Comment,
                    value    = comments.Value,
                    date     = comments.DateD
                };

                db.comments_users.Add(datos);

                db.SaveChanges();

                result = true;
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Exemple #3
0
 // POST api/<controller>
 public void Post(EN.UserComment comment)
 {
     controller.createComment(comment);
 }