Ejemplo n.º 1
0
        public ActionResult AddNewEmployee(bool isMale, string email, string phone, string address, string city, string state, int routeId, long ssn, string position, string name)
        {
            DatabaseInterface db = new DatabaseInterface();
            if (!db.IsSocialSecurityNumberUnique(ssn))
                return Json("false");

            Employee employee = new Employee()
            {
                Id = ObjectId.GenerateNewId(),
                SocialSecurityNumber = ssn,
                Position = position,
                Name = name,
                IsMale = isMale,
                Email = email,
                Phone = phone,
                Address = address,
                City = city,
                State = state,
                route = db.GetRouteByRouteId(routeId),
                EmployeeId = db.GetNextEmployeeId()

            };
            db.SaveEmployee(employee);
            return Json("true");
        }