Esempio n. 1
0
        public void UT_Portal_productComment()
        {
            var repo    = new mockPortalRepository();
            var service = new PortalProductCommentV1(repo);

            if (!service.Exec(null,
                              new AuthenticatedUser()
            {
                Id = 1
            },
                              new NewProductComment {
                Comment = "hello"
            }))
            {
                Assert.Fail("productComment // fail 1");
            }
        }
Esempio n. 2
0
        public ActionResult <string> ProductComment([FromBody] NewProductComment comment)
        {
            try
            {
                using (var db = new SqlConnection(GetDBConnectionString()))
                {
                    var service = new PortalProductCommentV1(portalRepository);
                    var ua      = new AuthenticatedUser();

                    if (!service.Exec(db, GetCurrentAuthenticatedUser(), comment))
                    {
                        return(BadRequest(service.Error));
                    }

                    return(Ok());
                }
            }
            catch (System.Exception ex)
            {
                return(BadRequest(new ServiceError {
                    DebugInfo = ex.ToString(), Message = _defaultError
                }));
            }
        }