Exemple #1
0
 public IHttpActionResult PostEmployee(EmployeeViewModel emp)
 {
     if (ModelState.IsValid)
     {
         try
         {
             _employee.PostEmpAtBL(emp);
         } catch (Exception)
         {
             throw;
         }
         return(Ok(emp));
     }
     else
     {
         return(BadRequest(ModelState));
     }
 }
Exemple #2
0
        public void TestCreateEmp()
        {
            var emp = new EmployeeViewModel {
                EmployeeName = "Hemant.Mohapatra",
                Department   = "Autofacets",
                MailID       = "*****@*****.**",
                DOJ          = Convert.ToDateTime("2020-10-10 18:30:00.000"),
                Phone        = 8900366424,
                Address      = "02, 3-Prahladnagar Society, Dr. Yagnik Rd, Surat-394105",
                Salary       = 32000,
                Age          = 23
            };

            _employee.PostEmpAtBL(emp);

            var x = _employee.GetEmpByNameBL(emp.EmployeeName);

            Assert.AreEqual(emp.EmployeeName, x.EmployeeName);
        }