コード例 #1
0
 public void addReply(Reply reply)
 {
     if(reply.Id != 0)
     {
         var original = _repo.Find<Reply>(reply.Id);
         original.IsHidden = true;
         _repo.SaveChanges();
     }
     else
     {
         _repo.Add<Reply>(reply);
         _repo.SaveChanges();
     }
 }        
コード例 #2
0
 public IHttpActionResult Post(Reply reply)
 {
     if (ModelState.IsValid)
     {
         if (reply.Id == 0)
         {
             var userId = this.User.Identity.GetUserId();
             reply.UserId = userId;
             reply.DateCreated = DateTime.Now;
             reply.IsHidden = false;
             _repo.addReply(reply);
             return Ok();               
         }
         else
         {
             _repo.addReply(reply);
             return Ok();
         }
     }
     return BadRequest();
 }