public IHttpActionResult Post(GitFileErrorCreate gitFileError) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var service = CreateGitFileErrorService(); if (!service.CreateGitFileError(gitFileError)) { return(InternalServerError()); } return(Ok()); }
public bool CreateGitFileError(GitFileErrorCreate model) { var entity = new GitFileError() { OwnerId = _userId, Title = model.Title, GitFileMessage = model.GitFileMessage, ProjectId = model.ProjectId, Resolved = model.Resolved, CreatedUtc = DateTimeOffset.Now }; using (var ctx = new ApplicationDbContext()) { ctx.GitFileErrors.Add(entity); return(ctx.SaveChanges() == 1); } }