Example #1
0
        public async Task <BaseResponse <string> > Post()
        {
            IUserService userService = new BookExchanger.Service.Services.UserService();

            try
            {
                var userId = await userService.CreateAsync(new BookExchanger.Service.Dto.User.Create.RequestDto()
                {
                    Address     = "ADDRESS",
                    City        = "CITY",
                    Country     = "COUNTRY",
                    Degree      = "DEGREE",
                    Description = "DESCRIPTION",
                    District    = "DISTRICT",
                    NickName    = "NICKNAME",
                    Password    = "******",
                    Phone       = "PHONE",
                    Province    = "PROVINCE",
                    UserName    = "******"
                });

                return(new BaseResponse <string>(userId));
            }
            catch (BookExchanger.Service.Exceptions.UserException ex)
            {
                return(new BaseResponse <string>(500, ex.ErrorMsgConvert()));
            }
            catch (Exception ex)
            {
                return(new BaseResponse <string>(500, ex.Message));
            }
        }
Example #2
0
        public async Task <BookExchanger.Service.Dto.User.Get.ResponseDto> Get(string id)
        {
            IUserService userService = new BookExchanger.Service.Services.UserService();
            var          user        = await userService.GetAsync(id, true);

            return(user);
        }