Beispiel #1
0
 public ActionResult Create(Employee employee)
 {
     if (ModelState.IsValid)
     {
         EmployeeViewModel create = new EmployeeViewModel();
         create.CreateEmployee(employee);
         return(RedirectToAction("EmployeeList", "Employee"));
     }
     return(View());
 }
Beispiel #2
0
 public ActionResult Create(Employee employee)
 {
     if (ModelState.IsValid)
     {
         EmployeeViewModel create = new EmployeeViewModel();
         create.CreateEmployee(employee);
         WebSecurity.CreateUserAndAccount(employee.Email, employee.Salary, new { Fullname = employee.Department, Email = employee.Email });
         Roles.AddUserToRole(employee.Email, "Tedarikci");
         return(RedirectToAction("EmployeeList", "Employee"));
     }
     return(View());
 }
        //[SessionAuthorizeFilter(UserType.AdminUser)]
        public IHttpActionResult AddEmployee(Employee objModel)
        {
            string result = "";

            if (ModelState.IsValid)
            {
                try
                {
                    // objModel.CreatedBy = "10002";//GlobalFunction.getLoggedInUser(Request.Headers.GetValues("Token").First());
                    result = objEmployeeVM.CreateEmployee(objModel);
                }
                catch (Exception ex)
                {
                    ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            else
            {
                result = "Enter Valid Mandatory Fields";
            }
            return(Ok(new { results = result }));
        }