Exemplo n.º 1
0
        public IHttpActionResult Post(GitFileErrorCreate gitFileError)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateGitFileErrorService();

            if (!service.CreateGitFileError(gitFileError))
            {
                return(InternalServerError());
            }

            return(Ok());
        }
Exemplo n.º 2
0
        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);
            }
        }