public HttpResponse Create(CreateRepoInputModel model)
        {
            string currentUserId = null;

            if (this.IsUserSignedIn())
            {
                currentUserId = this.GetUserId();
            }

            string[] repoTypes = new string[] { "Public", "Private" };

            //TODO: Check the input !!

            if (model.Name.Length < 3 || model.Name.Length > 10 || String.IsNullOrEmpty(model.Name))
            {
                return(this.Error("The Name length field must be between 3 and 10 characters long"));
            }

            if (String.IsNullOrEmpty(model.RepositoryType) || !repoTypes.Contains(model.RepositoryType))
            {
                return(this.Error("The Repo Type field must be fill correct"));
            }

            this.repositoryService.CreateRepo(model, currentUserId);

            return(this.Redirect("/Repositories/All"));
        }
        public void CreateRepo(CreateRepoInputModel model, string userId)
        {
            bool isPublic = model.RepositoryType == "Public" ? true : false;

            User user = this.db.Users.FirstOrDefault(u => u.Id == userId);

            Repository repository = new Repository()
            {
                Name = model.Name,
                CreatedOn = DateTime.UtcNow,
                IsPublic = isPublic,
                Owner = user
            };

            this.db.Repositories.Add(repository);
            this.db.SaveChanges();
        }