Ejemplo n.º 1
0
        public int Add(Dto.Input.UserDto entity)
        {
            var newEntity = Mapper.Map <User>(entity);

            _unitOfWork.Users.Add(newEntity);

            _unitOfWork.Complete();

            return(newEntity.Id);
        }
Ejemplo n.º 2
0
        public int Update(int id, Dto.Input.UserDto entity)
        {
            entity.Id = id;
            var oldEntity = _unitOfWork.Users.Get(id);

            Mapper.Map(entity, oldEntity);

            _unitOfWork.Users.Update(oldEntity);
            _unitOfWork.Complete();

            return(oldEntity?.Id ?? 0);
        }