| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Web.Http;
- using System.IO;
- using Newtonsoft.Json;
- using System.Xml;
- namespace mobiparc.Controllers
- {
- public class MobiparcController : ApiController
- {
- // GET: api/Mobiparc
- public IEnumerable<string> Get()
- {
-
- var files = Directory.EnumerateFiles(System.Web.HttpContext.Current.Server.MapPath(@"~/data/"));
- return files.ToArray();
- }
- // GET: api/Mobiparc/5
- public string Get(string name)
- {
- return File.ReadAllText(System.Web.HttpContext.Current.Server.MapPath(@"~/data/" + name + ".json"));
- }
- // POST: api/Mobiparc
- public int Post([FromBody]string value)
- {
- var data = System.Web.HttpContext.Current.Request["data"];
- var f= File.CreateText(System.Web.HttpContext.Current.Server.MapPath(@"~/data/" + Guid.NewGuid() +".json"));
- f.Write(data);
- f.Close();
- return 0;
- }
- // PUT: api/Mobiparc/5
- public void Put(int id, [FromBody]string value)
- {
- }
- // DELETE: api/Mobiparc/5
- public void Delete(int id)
- {
- }
- }
- }
|