Ejemplo n.º 1
0
 // GET api/values
 public List<FishTO> Get()
 {
     List<FishTO> fs = new List<FishTO>();
     //            /*
     using (f360Entities model = new f360Entities())
     {
         var fishes = from f in model.Fish select f;
         foreach(Fish ff in fishes) {
             fs.Add(new FishTO(ff));
         }
     }
       //          */
     return fs;
     //return new string[] { "value1", "value2" };
 }
Ejemplo n.º 2
0
        // POST api/values
        public List<FishTO> Post([FromBody]FishTO fishTO)
        {
            List<FishTO> fs = new List<FishTO>();
            Fish fish = fishTO.toFish();
            using (f360Entities model = new f360Entities())
            {
                model.Fish.Add(fish);
                model.SaveChanges();

                var fishes = from f in model.Fish select f;
                foreach (Fish ff in fishes)
                {
                    fs.Add(new FishTO(ff));
                }
            }
            return fs;
        }
Ejemplo n.º 3
0
        // GET api/values
        public List <FishTO> Get()
        {
            List <FishTO> fs = new List <FishTO>();

//            /*
            using (f360Entities model = new f360Entities())
            {
                var fishes = from f in model.Fish select f;
                foreach (Fish ff in fishes)
                {
                    fs.Add(new FishTO(ff));
                }
            }
            //          */
            return(fs);
            //return new string[] { "value1", "value2" };
        }
Ejemplo n.º 4
0
        // POST api/values
        public List <FishTO> Post([FromBody] FishTO fishTO)
        {
            List <FishTO> fs   = new List <FishTO>();
            Fish          fish = fishTO.toFish();

            using (f360Entities model = new f360Entities())
            {
                model.Fish.Add(fish);
                model.SaveChanges();

                var fishes = from f in model.Fish select f;
                foreach (Fish ff in fishes)
                {
                    fs.Add(new FishTO(ff));
                }
            }
            return(fs);
        }