Esempio n. 1
0
        public int AddEmployee([FromBody] List <RMG.Models.Employee> employee)
        {
            EmployeeContext context = HttpContext.RequestServices.GetService(typeof(RMG.Models.EmployeeContext)) as EmployeeContext;

            foreach (RMG.Models.Employee e in employee)
            {
                context.AddEmployee(e);
            }
            return(1);
        }
Esempio n. 2
0
        public ActionResult Create_Post()
        {
            Employee employee = new Employee();

            UpdateModel <Employee>(employee);
            if (ModelState.IsValid)
            {
                EmployeeContext empContext = new EmployeeContext();
                empContext.AddEmployee(employee);

                return(RedirectToAction("AllEmployeeDetails"));
            }
            return(View());
        }
Esempio n. 3
0
        public IActionResult Create([FromBody]  Employee employee)
        {
            if (employee == null)
            {
                return(Json(new
                {
                    success = false,
                    responseText = "Parameter is null"
                }));
            }

            _context.AddEmployee(employee);
            var emp           = _context.FetchLastEmployee();
            var totalPagesNum = (int)Math.Ceiling(_context.EmployeesCount() / (double)rowsOnPage);

            return(Json(new
            {
                totalPagesNum,
                updateRow = _context.EmployeesCount() % rowsOnPage != 0,
                success = true,
                employee = emp
            }));
        }