Exemplo n.º 1
0
        public BaseViewModel <TaskViewPage> update(TaskUpdateViewPage request)
        {
            var entity = _repository.GetById(request.Id);

            if (entity == null)
            {
                return(new BaseViewModel <TaskViewPage>
                {
                    Code = MessageConstants.NOTFOUND,
                    Description = ErrMessageConstants.NOTFOUND,
                    Data = null,
                    StatusCode = HttpStatusCode.NoContent
                });
            }
            entity.Title       = request.Title;
            entity.Description = request.Description;
            entity.Status      = request.Status;
            _repository.Update(entity);
            Save();
            return(new BaseViewModel <TaskViewPage>
            {
                Code = MessageConstants.SUCCESS,
                Description = null,
                StatusCode = HttpStatusCode.OK,
                Data = _mapper.Map <TaskViewPage>(entity)
            });
        }
Exemplo n.º 2
0
        public ActionResult <BaseViewModel <TaskViewPage> > update([FromBody] TaskUpdateViewPage request)
        {
            var result = _taskService.update(request);

            return(result);
        }