コード例 #1
0
        public ApiResponse AddServiceToWasher([FromBody] Models.ApiRequest.AddServiceToWasherRequest request)
        {
            if (request == null)
            {
                return(new ApiResponse(false, "Objeto de entrada no formato incorreto ou não informado."));
            }

            UserViewModel userViewModel = Mapper.Map <UserViewModel>(this._userAppService.GetByToken(request.Token));

            if (userViewModel == null)
            {
                return(new ApiResponse(false, "Token inválido."));
            }

            try
            {
                ServicesXUser serviceUser = new ServicesXUser();
                serviceUser.ServiceId     = request.ServiceId;
                serviceUser.UserId        = userViewModel.Id;
                serviceUser.SpecificPrice = request.SpecificPrice;
                this._serviceAppService.AddServiceToWasher(serviceUser);

                return(new ApiResponse(true, "Serviço adicionado com sucesso."));
            }
            catch (Exception ex)
            {
                return(new ApiResponse(false, ex.Message));
            }
        }
コード例 #2
0
        public int AddServiceToWasher(ServicesXUser serviceXUser)
        {
            using (MySqlConnection con = new MySqlConnection(conString))
            {
                var sql = @"insert into Services_X_User( 
                            UserId,
                            ServiceId,
                            SpecificPrice) 
                            values(
                            @UserId, 
                            @ServiceId,
                            @SpecificPrice)";

                return(con.Execute(sql, serviceXUser));
            }
        }
コード例 #3
0
 public int AddServiceToWasher(ServicesXUser serviceXUser)
 {
     return(this._serviceRepository.AddServiceToWasher(serviceXUser));
 }
コード例 #4
0
 public int AddServiceToWasher(ServicesXUser serviceXUser)
 {
     return(this._serviceService.AddServiceToWasher(serviceXUser));
 }