// PUT api/comment/5 public void Put(int id, Comment value) { }
internal static bool InsertTicketComment(string idTicket, Comment value, string userName) { var user = TTRepository.GetUser(userName); value.InsertBy = (user == null ? userName : user.FullName()); var contextDB = MongoDBHelper.GetContext(ConnectionString, DB); var insComm = new BsonDocument { { "Title", value.Title }, { "DateCreation", value.DateCreation }, { "InsertBy", value.InsertBy }, { "Text", value.Text }, { "IsRead", value.IsRead }, }; IMongoUpdate update = Update.Push("Comments", insComm); return MongoDBHelper.Modify(contextDB, TicketCollection, idTicket, update); }
// POST api/comment public Comment Post(string idTicket, Comment value) { TTRepository.InsertTicketComment(idTicket, value, User.Identity.Name); return value; }