public MemberComment(Member member, Comment comment) { Member = member; Comment = comment; CreatedAt = DateTime.Now; member.LastReceiveCommentAt = DateTime.Now; }
// POST api/values public HttpResponseMessage Post(CommentModels model) { var member = Uow.Members.GetByEmail(User.Identity.Name); //var member = Uow.Members.GetById(Guid.Parse(model.memberId)); var ocomment = new Comment(member, model.info, double.Parse(model.latitude), double.Parse(model.longitude)); Uow.Comments.Add(ocomment); Uow.Commit(); var response = Request.CreateResponse<Comment>(HttpStatusCode.Created, ocomment); var uri = Url.Link("DefaultApi", new { id = ocomment.Id }); response.Headers.Location = new Uri(uri); return response; }