Exemplo n.º 1
0
        public string delete(API_profile pro)
        {
            Application1Entities api = new Application1Entities();
            API_profile          obj = api.API_profile.Single(x => x.id == pro.id);

            api.API_profile.Remove(obj);
            api.SaveChanges();
            return("Success");
        }
Exemplo n.º 2
0
        public string update(API_profile pro)
        {
            Application1Entities api = new Application1Entities();
            API_profile          obj = api.API_profile.Single(x => x.id == pro.id);

            obj.name    = pro.name;
            obj.address = pro.address;
            api.SaveChanges();
            return("Success");
        }
Exemplo n.º 3
0
        public IHttpActionResult detail()
        {
            List <API_profile> api_pofiles;

            using (var context = new Application1Entities())
            {
                api_pofiles = context.API_profile.ToList();
            }
            return(Ok(api_pofiles));
        }
Exemplo n.º 4
0
        public IHttpActionResult search(int sid)
        {
            API_profile api_search;

            using (var context = new Application1Entities())
            {
                api_search = context.API_profile.Where(x => x.id == sid).FirstOrDefault();
            }

            return(Ok(api_search));
        }
Exemplo n.º 5
0
        public string add(API_profile pro)
        {
            Application1Entities api = new Application1Entities();
            API_profile          obj = new API_profile();

            obj.id      = pro.id;
            obj.name    = pro.name;
            obj.address = pro.address;
            api.API_profile.Add(obj);
            api.SaveChanges();
            return("Success");
        }