public void CreteCommit(CommitInputModel commit) { db.Commits.Add(new Commit { Description = commit.Descripion, CreatorId = commit.CreatorId, RepositoryId = commit.RepositoryId, CreatedOn = DateTime.UtcNow }); db.SaveChanges(); }
public void Create(CommitInputModel input, string userId) { var commit = new Commit { CreatorId = userId, CreatedOn = DateTime.UtcNow, Description = input.Description, RepositoryId = input.Id, }; this.db.Commits.Add(commit); this.db.SaveChanges(); }
public HttpResponse Create(string id, CommitInputModel input) { if (!this.IsUserSignedIn()) { return(this.Redirect("/Users/Login")); } if (string.IsNullOrWhiteSpace(input.Description) || input.Description.Length < 5) { return(this.Error("Invalid description name.")); } var userId = this.GetUserId(); this.commitsService.Add(input.Description, userId, id); return(this.Redirect("/")); }
public HttpResponse Create(CommitInputModel model) { if (!this.User.IsAuthenticated) { return(this.Unauthorized()); } var errors = this.validator.ValidateCommit(model); if (errors.Any()) { return(this.Error(errors)); } this.commitService.Add(model.Description, model.Id, this.User.Id); return(this.Redirect("/")); }
public HttpResponse Create(CommitInputModel 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 should be more than 5 characters.")); } var userId = this.GetUserId(); this.commitsService.Create(input, userId); return(this.Redirect("/Repositories/All")); }