Ejemplo n.º 1
0
        public IHttpActionResult Put(int id, [FromBody] cv tutor)
        {
            using (cvmakeEntities entities = new cvmakeEntities())
            {
                var entity = entities.cvs.FirstOrDefault(t => t.ID == id);

                if (entity == null)
                {
                    return(NotFound());
                }


                else
                {
                    entity.Names   = tutor.Names;
                    entity.Email   = tutor.Email;
                    entity.Addres  = tutor.Addres;
                    entity.Contact = tutor.Contact;



                    entities.SaveChanges();
                    return(CreatedAtRoute("DefaultApi", new
                    {
                        id = tutor.ID
                    }, tutor));
                }
            }
        }
Ejemplo n.º 2
0
        public IHttpActionResult Post(cv tb)
        {
            cvmakeEntities db = new cvmakeEntities();


            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }


            db.cvs.Add(tb);
            db.SaveChanges();
            return(CreatedAtRoute("DefaultApi", new
            {
                id = tb.ID
            }, tb));
        }
Ejemplo n.º 3
0
 public IEnumerable <cv> Get()
 {
     using (cvmakeEntities entities = new cvmakeEntities()) {
         return(entities.cvs.ToList());
     }
 }