Ejemplo n.º 1
0
        public IActionResult Create([FromBody] TempEmployee toCreate)
        {
            if (toCreate == null)
            {
                var newEmployeeUtils = new EmployeeUtils();

                return(Json(newEmployeeUtils.GetAllEmployees()));
            }
            else
            {
                var newEmployeeUtils = new EmployeeUtils();
                try
                {
                    if (toCreate.RawPw == null)
                    {
                        return(BadRequest("Your Password is Missing!!!!"));
                    }

                    var newEmpId = newEmployeeUtils.CreateNewUser(toCreate);
                    if (newEmpId > 0)
                    {
                        return(Json(newEmpId));
                    }
                    return(BadRequest("Couldnt create the Employee!"));
                }
                catch (Exception e)
                {
                    return(BadRequest("Couldnt create the Employee!" + e));
                }
            }
        }
        public IEnumerable <EmployeeInfoToShare> GetAll()
        {
            var newEmployeeUtils = new EmployeeUtils();

            return(newEmployeeUtils.GetAllEmployees());
        }