Exemplo n.º 1
0
 public async Task<IHttpActionResult> UpdateReviewReply(ReviewReply review)
 {
     if (User.Identity.IsAuthenticated)
     {
         if (!ModelState.IsValid)
         {
             return BadRequest();
         }
         db.Entry(review).State = EntityState.Modified;
         await db.SaveChangesAsync();
         return Ok("Done");
     }
     return BadRequest();
 }
Exemplo n.º 2
0
 public async Task<IHttpActionResult> AddReviewReply(ReviewReply review)
 {
     if (User.Identity.IsAuthenticated)
     {
         review.postedBy = User.Identity.GetUserId();
         review.time = DateTime.UtcNow;
         db.ReviewReplies.Add(review);
         await db.SaveChangesAsync();
         var ret =await (from rep in db.ReviewReplies
                   where rep.Id.Equals(review.Id)
                   select new
                   {
                       id = rep.Id,
                       time = rep.time,
                       description = rep.description,
                       postedBy = rep.postedBy,
                       postedByName = rep.AspNetUser.Email,
                   }).FirstOrDefaultAsync();
         return Ok(ret);
     }
     return BadRequest();
 }