Exemple #1
0
 public IHttpActionResult PostEmployee(TABLE_EMPLOYEE emp)
 {
     if (ModelState.IsValid)
     {
         context.PROC_EMP(emp.EMPLOYEENAME, emp.EMPLOYEESURNAME, emp.EMPLOYEEAGE, emp.EMPLOYEEMAIL);
         context.SaveChanges();
     }
     return(Ok());
 }
Exemple #2
0
        public ActionResult CreateEmployee(TABLE_EMPLOYEE emp)
        {
            if (ModelState.IsValid)
            {
                HttpClient ht = new HttpClient();
                ht.BaseAddress = new Uri("http://localhost:64918/api/EmployeeAPI");

                var insertPort = ht.PostAsJsonAsync <TABLE_EMPLOYEE>("EmployeeAPI", emp);
                insertPort.Wait();
                var savePort = insertPort.Result;
                if (savePort.IsSuccessStatusCode)
                {
                    ViewBag.Messagge = emp.EMPLOYEENAME + " is success.";
                }
            }
            return(View());
        }