示例#1
0
 public IActionResult Del(int id)
 {
     if (id == 0)
     {
         return(BadRequest());
     }
     FanyiNetwork.Models.Client model = new FanyiNetwork.Models.Client();
     using (var session = _documentStore.LightweightSession())
     {
         model = session.Query <FanyiNetwork.Models.Client>().SingleOrDefault(x => x.id == id);
         session.Delete <Client>(model);
         session.SaveChanges();
     }
     return(Ok("删除成功"));
 }
示例#2
0
        public IActionResult Get(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            FanyiNetwork.Models.Client model = new FanyiNetwork.Models.Client();

            using (var session = _documentStore.LightweightSession())
            {
                model = session.Query <FanyiNetwork.Models.Client>().SingleOrDefault(x => x.id == id);
            }

            if (model == null)
            {
                return(BadRequest());
            }

            return(new ObjectResult(model));
        }