public IEnumerable <string> Get()
        {
            List <string> results = new List <string>();

            using (var context = new Ruby_EmergencyContext())
            {
                foreach (RefEventType item in context.RefEventType)
                {
                    results.Add(item.ToString());
                }
            }
            return(new string[] { "value1", "value2" });
        }
Example #2
0
        public JsonResult Get()
        {
            List <RefEventType> result = new List <RefEventType>();

            using (var context = new Ruby_EmergencyContext())
            {
                foreach (RefEventType item in context.RefEventType)
                {
                    result.Add(item);
                }
            }
            return(Json(result));
        }
        public OkResult Add(JSONEmployee postedEmployee)
        {
            using (var context = new Ruby_EmergencyContext())
            {
                Employee newEmployee = new Employee();
                newEmployee.Fname    = postedEmployee.fname;
                newEmployee.Lname    = postedEmployee.lname;
                newEmployee.Email    = postedEmployee.email;
                newEmployee.Building = postedEmployee.building;
                newEmployee.Floor    = postedEmployee.floor;
                newEmployee.Room     = postedEmployee.room;
                newEmployee.Phone    = postedEmployee.phone;
                //status
                //warden?

                context.Add(newEmployee);
                context.SaveChangesAsync();
            }
            return(Ok());
        }
        public JsonResult Get()
        {
            List <JSONEmployee> result = new List <JSONEmployee>();

            using (var context = new Ruby_EmergencyContext())
            {
                foreach (Employee person in context.Employee)
                {
                    JSONEmployee newEmployee = new JSONEmployee();
                    newEmployee.fname    = person.Fname;
                    newEmployee.lname    = person.Lname;
                    newEmployee.email    = person.Email;
                    newEmployee.building = person.Building;
                    newEmployee.floor    = person.Floor;
                    newEmployee.room     = person.Room;
                    newEmployee.phone    = person.Phone;
                    result.Add(newEmployee);
                }
            }
            return(Json(result));
        }