Exemplo n.º 1
0
        public IActionResult UserPointEditor(int userId, int userPointId)
        {
            if (userId == 0)
            {
                return(R.Fail.WithError(ErrorCodes.ParentEntityMustBeNonZero).Result);
            }

            if (userId <= 0 || _userService.Count(x => x.Id == userId) == 0)
            {
                return(NotFound());
            }

            var userPoint = userPointId > 0 ? _userPointService.Get(userPointId) : new UserPoint()
            {
                UserId          = userId,
                ActivatorUserId = CurrentUser.Id
            };

            if (userPoint == null)
            {
                return(NotFound());
            }
            var model = _userModelFactory.Create(userPoint);

            return(R.Success.With("userPoint", model).Result);
        }
Exemplo n.º 2
0
        public void Add()
        {
            var user = userFactory.Create(id, firstname, lastname);

            userRepository.Add(user);
            TryClose();
        }
Exemplo n.º 3
0
        public IActionResult Profile()
        {
            var currentUser = ApplicationEngine.CurrentUser;
            var userModel   = _userModelFactory.Create(currentUser);

            return(R.Success.With("user", userModel).WithTimezones().Result);
        }
Exemplo n.º 4
0
        public ReturnRequestModel Create(ReturnRequest entity)
        {
            var model = new ReturnRequestModel()
            {
                Id = entity.Id,
                OrderedQuantity     = entity.OrderItem.Quantity,
                Quantity            = entity.Quantity,
                OrderNumber         = entity.Order.OrderNumber,
                ProductName         = entity.OrderItem.Product.Name,
                ProductId           = entity.OrderItem.ProductId,
                AttributeText       = _formatterService.FormatProductAttributes(entity.OrderItem.AttributeJson),
                ReturnRequestStatus = entity.ReturnRequestStatus,
                ImageUrl            = _mediaAccountant.GetPictureUrl(entity.OrderItem.Product.MediaItems.FirstOrDefault()),
                Remarks             = entity.Remarks,
                CustomerComments    = entity.CustomerComments,
                ReturnAction        = entity.ReturnAction,
                ReturnReason        = entity.ReturnReason,
                StaffComments       = entity.StaffComments,
                OrderId             = entity.OrderId,
                User = _userModelFactory.Create(entity.User),
                ReturnOrderNumber = entity.ReturnOrder?.OrderNumber,
                ReturnOrderId     = entity.ReturnOrder?.Id ?? 0,
                ReturnOption      = entity.ReturnOption
            };

            return(model);
        }
Exemplo n.º 5
0
    public async Task <IUserModel> FindByIdAsync(string id)
    {
        var user = await _userManager.FindByIdAsync(id);

        return(_userModelFactory.Create(user.Id, user.Email, user.Year, user.UserName));
    }