예제 #1
0
        public ActionResult <Result <bool> > UpdateDescription([FromBody] UpdateDescriptionRQ body)
        {
            var success = _taskRepo.UpdateDescription(body, UserId);

            if (success)
            {
                return(Result <bool> .Success(true));
            }
            else
            {
                return(Result <bool> .Fail("Failed to save changes."));
            }
        }
예제 #2
0
        public bool UpdateDescription(UpdateDescriptionRQ request, Guid userId)
        {
            var taskEntity = new TaskEntity() //AutoMapper
            {
                Id           = request.Id,
                TimeStamp    = request.TimeStamp,
                Description  = request.Description,
                DateModified = DateTime.UtcNow,
                ModifiedBy   = userId,
            };

            _context.Tasks.Attach(taskEntity);
            _context.Entry(taskEntity).Property(x => x.Description).IsModified  = true;
            _context.Entry(taskEntity).Property(x => x.DateModified).IsModified = true;
            _context.Entry(taskEntity).Property(x => x.ModifiedBy).IsModified   = true;

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