Ejemplo n.º 1
0
        public List <dynamic> DeleteEmployee([FromBody] EMPLOYEE eMPLOYEE)
        {
            UTRANSPORTDATABASEEntities2 db = new UTRANSPORTDATABASEEntities2();

            db.Configuration.ProxyCreationEnabled = false;
            db.EMPLOYEEs.Remove(db.EMPLOYEEs.Find(eMPLOYEE.EMPLOYEE_ID));
            db.SaveChanges();
            return(GetEmployee());
        }
Ejemplo n.º 2
0
        public List <dynamic> AddorEditEmployee([FromBody] EMPLOYEE eMPLOYEE)
        {
            UTRANSPORTDATABASEEntities2 db = new UTRANSPORTDATABASEEntities2();

            db.Configuration.ProxyCreationEnabled = false;

            if (eMPLOYEE.EMPLOYEE_ID == 0)
            {
                db.EMPLOYEEs.Add(eMPLOYEE);
                db.SaveChanges();
            }
            else
            {
                db.Entry(eMPLOYEE).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(GetEmployee());
        }