public ActionResult <SuccessResponse> Put(InfluencerUpdateRequest influencer, int id)
        {
            ActionResult result        = null;
            int          currentUserId = _authService.GetCurrentUserId();

            try
            {
                if (influencer.UserId == currentUserId && influencer.Id == id)
                {
                    _influencerService.Update(influencer, id);
                    SuccessResponse response = new SuccessResponse();
                    result = Ok200(response);
                }
                else
                {
                    result = NotFound404(new ErrorResponse("URL Id does not match body id."));
                }
            }
            catch (Exception ex)
            {
                Logger.LogError(ex.ToString());
                result = StatusCode(500, "Internal Server Error");
            }
            return(result);
        }
Esempio n. 2
0
        public void Update(InfluencerUpdateRequest influencer, int id)
        {
            _dataProvider.ExecuteNonQuery("dbo.Influencer_Update_v2", (param) =>
            {
                param.AddWithValue("@Id", influencer.Id);
                param.AddWithValue("@UserId", influencer.UserId);
                param.AddWithValue("@Bio", influencer.Bio);
                param.AddWithValue("@FaqId", influencer.FaqId);
                param.AddWithValue("@MilestoneId", influencer.MilestoneId);
                param.AddWithValue("@IsActive", influencer.IsActive);
            });

            string cachedKey = key + influencer.UserId.ToString();

            _cacheService.Remove(cachedKey);
        }