public void CreateCommit(CreateCommitInputModel commitModel, string userId)
        {
            var commit = new Commit()
            {
                CreatorId    = userId,
                Description  = commitModel.Description,
                RepositoryId = commitModel.Id
            };

            this.db.Commits.Add(commit);
            this.db.SaveChanges();
        }
        public HttpResponse Create(string id)
        {
            var repo = this.repositoriService.GetRepoById(id);

            var model = new CreateCommitInputModel()
            {
                Name = repo.Name,
                Id   = repo.Id
            };

            return(this.View(model));
        }
Example #3
0
        public void CreateCommit(string userId, string repositoryId, CreateCommitInputModel model)
        {
            var commit = new Commit
            {
                Description  = model.Description,
                CreatedOn    = DateTime.UtcNow,
                CreatorId    = userId,
                RepositoryId = repositoryId
            };

            this.dbContext.Commits.Add(commit);
            this.dbContext.SaveChanges();
        }
Example #4
0
        public HttpResponse Create(CreateCommitInputModel input)
        {
            if (!this.IsUserSignedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (input.Description.Length < 5 || string.IsNullOrEmpty(input.Description))
            {
                return(this.Error("Description length must be longer than 5 "));
            }

            this.commitsService.Create(input.Description, input.Id, this.GetUserId());
            return(this.Redirect("/Repositories/All"));
        }
Example #5
0
        public HttpResponse Create(CreateCommitInputModel model)
        {
            var commit = new Commit
            {
                Description  = model.Description,
                CreatedOn    = DateTime.UtcNow,
                CreatorId    = this.User.Id,
                RepositoryId = model.Id
            };

            this.db.Commits.Add(commit);

            this.db.SaveChanges();

            return(Redirect("/Repositories/All"));
        }
        public HttpResponse Create(string id)
        {
            if (!IsUserSignedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            string repoName  = this.repositoryService.GetRepositoryName(id);
            var    viewModel = new CreateCommitInputModel
            {
                Id   = id,
                Name = repoName
            };

            return(this.View(viewModel));
        }
Example #7
0
        public HttpResponse Create(CreateCommitInputModel commitModel)
        {
            if (!this.IsUserSignedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (string.IsNullOrEmpty(commitModel.Description) || commitModel.Description.Length < GlobalValidations.CommitDescriptionMinLength)
            {
                return(this.Error(GlobalErrors.invalidCommitDescription));
            }

            var userId = this.GetUserId();

            this.commitsService.CreateCommit(commitModel, userId);
            return(this.Redirect("/Repositories/All"));
        }
        public HttpResponse Create(string id, CreateCommitInputModel model)
        {
            if (!IsUserSignedIn())
            {
                return(this.Redirect("/"));
            }

            if (string.IsNullOrEmpty(model.Description) ||
                model.Description.Length < 5)
            {
                return(this.Error("Description is required and should be more than 5 characters long."));
            }

            var userId = this.GetUserId();

            this.commitsService.CreateCommit(userId, id, model);
            return(this.Redirect("/Repositories/All"));
        }
        public HttpResponse Create(CreateCommitInputModel input)
        {
            if (!this.IsUserSignedIn())
            {
                return(this.Redirect("/Users/Login"));
            }

            if (string.IsNullOrWhiteSpace(input.Description) || input.Description.Length < 5)
            {
                return(this.Error("Description is required and have min length of 5 characters."));
            }

            var userId = this.GetUserId();

            this.commitsService.CreateCommit(input.Description, input.Id, userId);

            return(this.Redirect("/Repositories/All"));
        }
        public HttpResponse Create(CreateCommitInputModel model)
        {
            if (!this.IsUserSignedIn())
            {
                return(Redirect("/Users/Login"));
            }

            if (string.IsNullOrEmpty(model.Description) || model.Description.Length < 5)
            {
                return(this.Error("Description must not be less than 5 characters."));
            }

            if (string.IsNullOrEmpty(model.Id))
            {
                return(this.Error("Repository is required."));
            }

            this.commitsService.Create(model.Description, this.GetUserId(), model.Id);

            return(this.Redirect("/Repositories/All"));
        }