Exemplo n.º 1
0
        public IHttpActionResult PostNew(FeedbackModel model)
        {
            try
            {
                using (DbEntities _db = new DbEntities())
                {
                    FeedbackContent _new = new FeedbackContent();
                    _new.ViewId      = model.NewPost.Visibility;
                    _new.CreatedBy   = model.NewPost.UserId;
                    _new.CreatedDate = model.NewPost.Created;
                    _new.FeedbackId  = model.NewPost.FeedbackId.Value;
                    _new.Content     = model.NewPost.Post;

                    _db.FeedbackContent.Add(_new);
                    _db.SaveChanges();

                    FeedbackModel _toView = new FeedbackModel();
                    _toView.id           = model.NewPost.FeedbackId.Value;
                    _toView.Children     = GenerateFeedbackContent(model.NewPost.FeedbackId.Value);
                    _toView.Visibilities = new List <System.Web.Mvc.SelectListItem>();

                    return(Ok(_toView));
                }
            }
            catch (Exception ex)
            {
                //Debug.WriteLine(ex.Message);
                return(Ok());
                //return ex.InnerException.Message.ToString();
            }
        }
 public FeedbackResponseData FeedbackThroughDll(FeedbackContent content)
 {
     var exception = new Exception();
     FeedbackResponseData feedbackResponseData = new FeedbackResponseData();
     var postContent = new StringBuilder(JSON.Serialize(content, option));
     try
     {
         Dlink(new StringBuilder(authToken), new StringBuilder(PublicType.Feedback), postContent, new StringBuilder(baseUrl), Int32.Parse(timeOut) * 1000);
         feedbackResponseData = JSON.Deserialize<FeedbackResponseData>(postContent.ToString(), option);
     }
     catch (Win32Exception ex)
     {
         //exception = ex;
         feedbackResponseData.Success = "F";
         feedbackResponseData.ErrorCode = "";
         feedbackResponseData.ErrorMsg = ex.Message;
     }
     return feedbackResponseData;
 }