예제 #1
0
        /// <summary>
        /// Obtiene los doctores filtrados por su especialidad
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static List <Employee> GetDoctorBySpecialty(int id)
        {
            string     url          = String.Format("/specialty/{0}/doctors", id);
            string     res          = RESTHelper.Execute(url, "", "GET");
            Employe_Tr deserealized = JsonConvert.DeserializeObject <Employe_Tr>(res);

            return(deserealized.doctors);
        }
예제 #2
0
        /// <summary>
        /// Crea un empleado
        /// </summary>
        /// <param name="emp">Objeto empleado</param>
        public static string CreateEmployee(Employee emp)
        {
            //{ "employee":{ "name":"lalo","last_name":"lalo","date_birth":"2010-02-02","gender":"M","curp":"AAAA000000HAAAAA00","rfc":"AAAA000000000","address":"address","email":"*****@*****.**","phone":"4777867","profession":"doctor","job":"doctor","specialty_id":1} }
            string     param = "/employee";
            Employe_Tr empTr = new Employe_Tr();

            empTr.employee = emp;
            //string json = String.Format("{ \"employee\":{ \"name\":\"{0}\",\"last_name\":\"{1}\",\"date_birth\":\"{2}\",\"gender\":\"{3}\",\"curp\":\"{4}\",\"rfc\":\"{5}\",\"address\":\"{6}\",\"email\":\"{7}\",\"phone\":\"{8}\",\"profession\":\"{9}\",\"job\":\"{10}\",\"specialty_id\":{11}} }", emp.name, emp.last_name, emp.date_birth, emp.gender, emp.curp, emp.rfc, emp.address, emp.email, emp.phone, emp.profession, emp.job, emp.specialty_id.ToString());
            string json = JsonConvert.SerializeObject(empTr);
            string resp = RESTHelper.PostJSON(param, json);

            return(resp);
        }