Пример #1
0
 public void Add(Review review)
 {
     var reviewElement = new XElement ("review");
     foreach (var property in typeof(Review).GetProperties()) {
         var propertyName = property.Name.ToLower ();
         if (propertyName != "tags" && propertyName != "id"
             && propertyName != "communutydiscussionscount" && propertyName != "postid")
             reviewElement.Add (new XElement (propertyName) { Value = (string)property.GetValue (review) });
         else if (propertyName == "tags")
             reviewElement.Add (new XElement ("tags") { Value = String.Join (",", review.Tags) });
         else
             reviewElement.Add (new XElement (propertyName) { Value = ((int)property.GetValue (review)).ToString() });
     }
     _database.Root.Add (reviewElement);
     _database.Save (_dbPath);
 }
Пример #2
0
 public virtual void Add(Review review)
 {
 }
Пример #3
0
 public ActionResult PostReview(int id, string description, string tags, string author="",
     string authorId="", string title="", string category="")
 {
     var sign = author != "" ? "Отзыв написан: " + author : "";
     var api = new Api ();
     api.AddToken (new Token (token));
     var message = new StringBuilder ();
     message.AppendLine (sign);
     message.AppendLine (title);
     message.Append (description);
     var postRequest = api.Wall.PostSync (ownerId: -106361362, message: message.ToString());
     var review = new Review () {
         Id = repository.GetNextId(),
         PostId = postRequest.PostId,
         Title = title,
         Description = description,
         Tags = tags.Split (','),
         CommunityUrl = "https://vk.com/moiseyfomin?w=wall-106361362_" + postRequest.PostId,
         CommunutyDiscussionsCount = 0,
         Category = category,
         Date = DateTime.Now.ToShortDateString(),
         Author = author,
         AuthorId = authorId
     };
     pendingRepository.Delete (id);
     repository.Add (review);
     return Content ("accepted");
 }