Esempio n. 1
0
        public HttpResponseMessage AddProblem(HttpRequestMessage request, ProblemViewModel problem)
        {
            return(CreateHttpResponse(request, () =>
            {
                var userId = _membershipService.GetUserIdByLogin(HttpContext.Current.User.Identity.Name);

                var problemEntity = _mapper.Map <Problem>(problem);
                problemEntity.UserId = userId;

                var addedProblemEntity = _problemService.AddProblem(problemEntity);

                var addedProblem = _mapper.Map <ProblemViewModel>(addedProblemEntity);

                return request.CreateResponse(HttpStatusCode.OK, addedProblem);
            }));
        }