public HttpResponse Create(CommitInputViewModel model) { string userId = this.GetUserId(); if (String.IsNullOrEmpty(model.Description) || model.Description.Length < 5) { return(this.Error("The Description must be minimum 5 characters")); } this.commitsService.CreateCommit(userId, model); return(this.Redirect("/Commits/All")); }
public void CreateCommit(string userId, CommitInputViewModel model) { Commit commit = new Commit() { Description = model.Description, CreatedOn = DateTime.UtcNow, RepositoryId = model.Id, CreatorId = userId }; this.db.Commits.Add(commit); this.db.SaveChanges(); }