示例#1
0
        public bool UpdateError(ErrorEdit model)
        {
            using (var ctx = new ApplicationDbContext())
            {
                var entity =
                    ctx
                    .Errors
                    .Single(e => e.ErrorId == model.ErrorId && e.OwnerId == _userId);

                entity.Title       = model.Title;
                entity.Resolved    = model.Resolved;
                entity.ModifiedUtc = DateTimeOffset.Now;

                return(ctx.SaveChanges() == 1);
            }
        }
示例#2
0
        public IHttpActionResult Put(ErrorEdit error)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var service = CreateErrorService();

            if (!service.UpdateError(error))
            {
                return(InternalServerError());
            }

            return(Ok("You've sucessfully updated the error."));
        }