Exemplo n.º 1
0
        public HttpResponseMessage CheckIfDuplicateClaim([FromBody] DuplicateEmpCheck Employee)
        {
            if (context.CheckIfTokenValid(Employee.Token) != 10001)
            {
                return(new HttpResponseMessage(HttpStatusCode.Unauthorized)
                {
                    Content = new StringContent("Invalid token")
                });
            }
            if (String.IsNullOrEmpty(Employee.EmpFirstName) || String.IsNullOrEmpty(Employee.EmplastName) || Employee.DOB == null)
            {
                return(new HttpResponseMessage(HttpStatusCode.BadRequest)
                {
                    Content = new StringContent("Client ID, First name, Last name and date of birth must be specified")
                });
            }

            return(new HttpResponseMessage(HttpStatusCode.OK)
            {
                Content = new StringContent(JsonConvert.SerializeObject(context.DetectDuplicateClaim(Employee.ClientID, Employee.EmpNu, Employee.EmpFirstName, Employee.EmplastName, Employee.DOB, Employee.SIN)))
            });
        }