// GET: api/Users
 public HttpResponseMessage Get()
 {
     return(new HttpResponseMessage(HttpStatusCode.OK)
     {
         Content = new ObjectContent <List <User> >(LogicUsers.GetAllUsers(), new JsonMediaTypeFormatter())
     });
 }
        public HttpResponseMessage Login([FromBody] UserHelp value)
        {
            if (ModelState.IsValid)
            {
                User user = LogicUsers.GetAllUsers().FirstOrDefault(p => p.UserName == value.UserName && p.Password == value.Password);
                return((user != null) ?
                       new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new ObjectContent <User>(user, new JsonMediaTypeFormatter())
                }:
                       new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new ObjectContent <String>("You aren't singed", new JsonMediaTypeFormatter())
                });
            }
            List <string> ErrorList = new List <string>();

            //if the code reached this part - the user is not valid
            foreach (var item in ModelState.Values)
            {
                foreach (var err in item.Errors)
                {
                    ErrorList.Add(err.ErrorMessage);
                }
            }

            return(new HttpResponseMessage(HttpStatusCode.BadRequest)
            {
                Content = new ObjectContent <List <string> >(ErrorList, new JsonMediaTypeFormatter())
            });
        }