public long ProductAddComment(SqlConnection db, long userId, NewProductComment comment) { string sql = @"INSERT INTO [ProductComment] (ProductID,UserID,Comment,DateAdded) VALUES (@ProductID,@UserID,@Comment,@DateAdded); SELECT CAST(SCOPE_IDENTITY() as bigint)"; return(db.Query <long>(sql, new { comment.ProductID, UserID = userId, comment.Comment, DateAdded = DateTime.Now }).Single()); }
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 })); } }
public long ProductAddComment(SqlConnection db, long userId, NewProductComment comment) { return(1); }
public bool Exec(SqlConnection db, AuthenticatedUser au, NewProductComment comment) { return(repository.ProductAddComment(db, au.Id, comment) > 0 ? true : false); }
public ActionResult <string> Token_ProductComment([FromBody] NewProductComment obj) { return(ExecuteRemoteService(obj, token: true)); }