// [Route("UpdateInternalComments/{InternalCommentId:int}")] public IActionResult UpdateInternalComments(int InternalCommentsId, [FromBody] InternalCommentsDTO InternalCommentsDTO) { if (!ModelState.IsValid) { return BadRequest(); } if (InternalCommentsDTO == null) { return BadRequest(); } var InternalComments = _choiceRepoistory.GetById<InternalComments>(c => c.InternalCommentsId == InternalCommentsId); if (InternalComments == null) { return BadRequest(); } InternalComments.InternalCommentsId = InternalCommentsDTO.InternalCommentsId; InternalComments.BookingId = InternalCommentsDTO.BookingId; InternalComments.Comments = InternalCommentsDTO.Comments; InternalComments.InternalNotifyId = InternalCommentsDTO.InternalNotifyId; InternalComments.CreatedDate = InternalCommentsDTO.CreatedDate; InternalComments.CreatedBy = InternalCommentsDTO.CreatedBy; InternalComments.SharepointId = InternalCommentsDTO.SharepointId; _choiceRepoistory.Attach(InternalComments); _choiceRepoistory.Complete(); return NoContent(); }
public ActionResult InternalComments([FromBody] InternalCommentsDTO InternalCommentsDTO) { if (!ModelState.IsValid) { return BadRequest(); } if (InternalCommentsDTO == null) { return BadRequest(); } var checkInternalCommentIdinDb = _choiceRepoistory.GetInternalComments().Find(c => c.InternalCommentsId == InternalCommentsDTO.InternalCommentsId); if (checkInternalCommentIdinDb != null) { return BadRequest(); } InternalComments newlyInternalComments = new InternalComments() { InternalCommentsId = InternalCommentsDTO.InternalCommentsId, BookingId = InternalCommentsDTO.BookingId, Comments = InternalCommentsDTO.Comments, InternalNotifyId = InternalCommentsDTO.InternalNotifyId, CreatedDate = InternalCommentsDTO.CreatedDate, CreatedBy = InternalCommentsDTO.CreatedBy, SharepointId = InternalCommentsDTO.SharepointId, }; _choiceRepoistory.SetInternalComments(newlyInternalComments); _choiceRepoistory.Complete(); return CreatedAtRoute("GetInternalComments", new { comments = newlyInternalComments.Comments }, newlyInternalComments); }