public ActionResult Create(CodeLocation newCodeLocation) { if (newCodeLocation.Id != Guid.Empty) { Response.StatusCode = (int) HttpStatusCode.PreconditionFailed; return Json(new PreconditionFailedException() { Message = "Id cannot have a value when creating a CodeLocation" }); } var db = Storage.CreateConnection(); var codeLocation = (CodeLocation)db.CodeLocations.Insert(newCodeLocation); Response.StatusCode = (int)HttpStatusCode.Created; return Json(codeLocation); }
public CommitData AddCommit(CommitData newCommit, CodeLocation codeLocation) { newCommit.RepositoryId = codeLocation.Id; return Database.Commits.Insert(newCommit); }