예제 #1
0
        // GET api/values/5

        public MOCK_DATA Get(Guid id)
        {
            using (var db = new richmondDayEntities())
            {
                employee = db.MOCK_DATA.FirstOrDefault(f => f.emp_id == id);
            }
            return(employee);
        }
예제 #2
0
 // GET api/values
 public string Get()
 {
     using (var db = new richmondDayEntities())
     {
         employees = db.MOCK_DATA.ToList();
         return(JsonConvert.SerializeObject(employees));
     }
 }
예제 #3
0
        // DELETE api/values/5
        public void Delete(Guid id)
        {
            using (var db = new richmondDayEntities())
            {
                employees = db.MOCK_DATA.ToList();
                employee  = employees.FirstOrDefault(f => f.emp_id == id);

                db.MOCK_DATA.Remove(employee);
                db.SaveChanges();
            }
        }
예제 #4
0
        // PUT api/values/5
        public void Put(EmployeeModel emp)
        {
            using (var db = new richmondDayEntities())
            {
                employee = db.MOCK_DATA.FirstOrDefault(f => f.emp_id == emp.emp_id);

                employee.email      = emp.email;
                employee.first_name = emp.first_name;
                employee.last_name  = emp.last_name;

                db.SaveChanges();
            }
        }
예제 #5
0
        // POST api/values
        public void Post(EmployeeModel emp)
        {
            using (var db = new richmondDayEntities())
            {
                employee.email      = emp.email;
                employee.first_name = emp.first_name;
                employee.last_name  = emp.last_name;
                employee.emp_id     = Guid.NewGuid();

                db.MOCK_DATA.Add(employee);
                db.SaveChanges();
            }
        }