public ActionResult Create(Reviewer reviewer)
        {
            Random random = new Random();

            if (ModelState.IsValid)
            {
                var provider = new ReviewerProvider();
                reviewer.Id = provider.GetNextId();
                provider.Add(reviewer);
                return(RedirectToAction("Index"));
            }
            return(View(reviewer));
        }
        public ActionResult SyncData()
        {
            var count            = 0;
            var reviewerProvider = new ReviewerProvider();
            var message          = new MessageViewModel();
            var usersGreenhouse  = greenHouseAPI.GetUsers();

            if (usersGreenhouse == null || usersGreenhouse.Count == 0)
            {
                message.Type        = MessageType.Error;
                message.Title       = "Not Found";
                message.Content     = "There're not data found vie GreenHouse API ";
                TempData["Message"] = message;
                return(RedirectToAction("Index"));
            }

            foreach (var user in usersGreenhouse)
            {
                var reviewer = reviewerProvider.Get(int.Parse(user.Id));
                if (reviewer != null)
                {
                    continue;
                }
                reviewer = new Reviewer()
                {
                    Id    = int.Parse(user.Id),
                    Name  = user.Name,
                    Email = string.Join(";", user.Emails),
                };
                reviewerProvider.Add(reviewer);
                count++;
            }

            if (count == 0)
            {
                message.Type    = MessageType.Info;
                message.Title   = "Finished";
                message.Content = string.Format("No more updates found...", count);
            }
            else
            {
                message.Type    = MessageType.Success;
                message.Title   = "Success";
                message.Content = string.Format("Added new {0} reviewer(s)...", count);
            }

            TempData["Message"] = message;

            return(RedirectToAction("Index"));
        }