Пример #1
0
        public async Task <HttpResponseMessage> Delete(int id)
        {
            var body = await Request.Content.ReadAsStringAsync();

            var context = new ContextImplement(
                sessionStatus: User?.Identity?.IsAuthenticated == true,
                sessionData: User?.Identity?.IsAuthenticated == true,
                apiRequestBody: body);
            var controller = new Pleasanter.Controllers.Api.UsersController();
            var result     = controller.Delete(context: context, id: id);

            return(result.ToHttpResponse(Request));
        }
        public async Task <HttpResponseMessage> Create()
        {
            var body = await Request.Content.ReadAsStringAsync();

            var context = new ContextImplement(
                sessionStatus: User?.Identity?.IsAuthenticated == true,
                sessionData: User?.Identity?.IsAuthenticated == true,
                apiRequestBody: body,
                contentType: Request.Content.Headers.ContentType.MediaType);
            var controller = new Pleasanter.Controllers.Api.UsersController();
            var result     = controller.Create(context: context);

            return(result.ToHttpResponse(Request));
        }
Пример #3
0
        public ContentResult Delete(int id)
        {
            var body = default(string);

            using (var reader = new StreamReader(Request.Body)) body = reader.ReadToEnd();
            var context = new ContextImplement(
                sessionStatus: User?.Identity?.IsAuthenticated == true,
                sessionData: User?.Identity?.IsAuthenticated == true,
                apiRequestBody: body);
            var controller = new Pleasanter.Controllers.Api.UsersController();
            var result     = controller.Delete(context: context, id: id);

            return(result.ToHttpResponse(Request));
        }