/// <summary> /// Récupére l'entité désignée par l'id en paramétre. /// </summary> /// <param name="id">Id de l'entité</param> /// <returns>Message de retour avec l'entité</returns> public async Task <DTO.Comment> GetById(long id) { ENT.Comment comment = await CommentDomain.Get(id); DTO.Comment dtoComment = null; if (comment != null) { dtoComment = Mapper.Map <ENT.Comment, DTO.Comment>(comment); } return(dtoComment); }
/// <summary> /// Ajoute un commentaire en base /// </summary> /// <param name="comment">Commentaire</param> /// <returns>Message de retour</returns> public async Task <HttpResponseMessageResult> Post(DTO.Comment comment) { ENT.Comment element = Mapper.Map <DTO.Comment, ENT.Comment>(comment); comment = Mapper.Map <ENT.Comment, DTO.Comment>(await CommentDomain.Add(element)); HttpResponseMessageResult res = new HttpResponseMessageResult() { IsSuccess = true }; res.Json = JsonConvert.SerializeObject(comment); return(res); }