public IHttpActionResult Put(BuildErrorEdit buildError)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateBuildErrorService();

            if (!service.UpdateBuildError(buildError))
            {
                return(InternalServerError());
            }

            return(Ok("The build error has been updated!"));
        }
예제 #2
0
        public bool UpdateBuildError(BuildErrorEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .BuildErrors
                    .Single(e => e.ErrorId == model.ErrorId && e.OwnerId == _userId);
                entity.Title             = model.Title;
                entity.Resolved          = model.Resolved;
                entity.LineNumber        = model.LineNumber;
                entity.BuildErrorMessage = model.BuildErrorMessage;
                entity.ModifiedUtc       = DateTimeOffset.Now;

                return(ctx.SaveChanges() == 1);
            }
        }