public HttpResponseMessage AddUpdateFeedback(FeedbackDomainModel model)
 {
     try
     {
         HttpResponseMessage httpResponse = new HttpResponseMessage();
         var res = feedbackRepository.AddUpdateFeedback(model);
         if (res != null && res.isSuccess)
         {
             httpResponse = Request.CreateResponse(HttpStatusCode.OK, res);
         }
         else
         {
             httpResponse = Request.CreateResponse(HttpStatusCode.Unauthorized, res);
         }
         return(httpResponse);
     }
     catch (Exception ex)
     {
         ErrorLog.LogError(ex);
         throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
         {
             Content      = new StringContent("An error occurred, please try again or contact the administrator."),
             ReasonPhrase = "An error occurred, please try again or contact the administrator.",
             StatusCode   = HttpStatusCode.InternalServerError
         });
     }
 }
 public ActionResult AddUpdateFeedback(FeedbackDomainModel model)
 {
     if (model != null)
     {
         model.UserId = UserManager.user.UserId;
         var serialized = new JavaScriptSerializer().Serialize(model);
         var client     = new HttpClient();
         var content    = new StringContent(serialized, System.Text.Encoding.UTF8, "application/json");
         client.BaseAddress = new Uri(HttpContext.Request.Url.AbsoluteUri);
         var result = client.PostAsync(BaseURL + "/api/Feedback/AddUpdateFeedback", content).Result;
         if (result.StatusCode == HttpStatusCode.OK)
         {
             var contents = result.Content.ReadAsStringAsync().Result;
             var Response = new JavaScriptSerializer().Deserialize <ResponseModel>(contents);
         }
     }
     return(RedirectToAction("_Feedback"));
 }
        public ResponseDomainModel AddUpdateFeedback(FeedbackDomainModel model)
        {
            ResponseDomainModel objRes = new ResponseDomainModel();

            try
            {
                int FeedbackId = objHelper.ExecuteScalar("AddUpdateFeedback", new
                {
                    FeedbackId  = model.FeedbackId,
                    ProjectId   = model.ProjectId,
                    UserId      = model.UserId,
                    FeedTypeId  = model.FeedTypeId,
                    Name        = model.Name,
                    Description = model.Description,
                    Feed        = model.Feed,
                    IsActive    = model.IsActive,
                    CreatedDate = DateTime.Now,
                    IsDeleted   = false
                });
                if (model.FeedbackId > 0)
                {
                    objRes.isSuccess = true;
                    objRes.response  = "Feedback updated successfully.";
                }
                else if (FeedbackId > 0)
                {
                    objRes.isSuccess = true;
                    objRes.response  = "Feedback added successfully.";
                }
                else
                {
                    objRes.isSuccess = false;
                    objRes.response  = "Something went wrong, please try again.";
                }
            }
            catch (Exception ex)
            {
                ErrorLog.LogError(ex);
                objRes.isSuccess = false;
                objRes.response  = ex.Message;
            }
            return(objRes);
        }