//[SanatyarWebCms.CustomExceptionFilter] public HttpResponseMessage Post() { var httpRequest = HttpContext.Current.Request; var FbToken = httpRequest.Form.Get("FbToken").Trim(); var userid = httpRequest.Form.Get("UserId").Trim(); Paye.Models.PayeDBEntities db = new Paye.Models.PayeDBEntities(); var list = db.Users.FirstOrDefault(x => x.UserId.ToString() == userid); list.Token = FbToken.Trim(); db.SaveChanges(); return(new HttpResponseMessage() { Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(list.ServicesIds), Encoding.UTF8, "application/json") }); }
//[SanatyarWebCms.CustomExceptionFilter] public HttpResponseMessage Post() { Paye.Models.PayeDBEntities db = new Paye.Models.PayeDBEntities(); var httpRequest = HttpContext.Current.Request; if (httpRequest.Headers["PayeBash"] != null) { var postid = httpRequest.Form.Get("PostId"); var userid = httpRequest.Form.Get("UserId"); var refID = httpRequest.Form.Get("refID"); var Amount = httpRequest.Form.Get("Amount"); var TypeOfPay = httpRequest.Form.Get("TypeOfPay"); if (postid != null) { Payment tb = new Payment(); tb.UserId = Guid.Parse(userid); tb.PostId = Guid.Parse(postid); tb.refID = refID == null ? "" : refID.Trim(); tb.Amount = Amount.Trim(); tb.CreateDate = DateTime.Now; db.Payments.Add(tb); db.SaveChanges(); var list = (from x in db.Posts where x.postId.ToString() == postid select x).FirstOrDefault(); list.state = 2; db.SaveChanges(); } return(new HttpResponseMessage() { Content = new StringContent(Newtonsoft.Json.JsonConvert.SerializeObject(postid), Encoding.UTF8, "application/json") }); } else { throw new BusinessException("خطا در پارامترهای ورودی"); } }
// GET: getWebPostDetails public ActionResult Index(string id) { PayeDBEntities db = new Paye.Models.PayeDBEntities(); var post = (from x in db.Posts where x.postId.ToString() == id select x).ToList().FirstOrDefault(); List <string> BaseProperty = new List <string>(); if (!string.IsNullOrEmpty(post.phoneNumber)) { BaseProperty.Add("شماره تماس : " + PersianNumber(post.phoneNumber).Trim() + "\n"); } if (!string.IsNullOrEmpty(post.link)) { BaseProperty.Add("وب سایت : " + PersianNumber(post.link).Trim() + "\n"); } BaseProperty.Add("هزینه : " + PersianNumber(post.cost).Trim() + "\n"); BaseProperty.Add("تعداد هم پایه : " + PersianNumber(post.numberFollowers) + "\n"); BaseProperty.Add("تاریخ شروع : " + post.startDate.ToString() + "\n"); BaseProperty.Add("تاریخ پایان : " + post.endDate.ToString() + "\n"); BaseProperty.Add("مهلت هم پا شدن : " + BaseSystemModel.ResizeImage.GetDateDifferencesAsDescription2(DateTime.Now, Convert.ToDateTime(post.timeToJoin.ToString()), 0) + "\n"); BaseProperty.Add("هشتگ : " + post.tag.Trim() + "\n"); //BaseProperty.Add("راه های ارتباطی : " + post.ContactWays.Trim()); BaseProperty.Add("توضیحات : " + PersianNumber(post.description) + "\n"); returnPostdetails post2 = new returnPostdetails(); var item = db.Users.Where(r => r.Id == post.userId).FirstOrDefault(); if (post.state == 9) { post2.title = post.title.Trim() + "(این برنامه لغو گردید)"; } else { post2.title = post.title.Trim(); } string[] Ids = post.applicants.Split(','); var query = (from x in db.Users where Ids.Any(a => a == x.Id.ToString()) orderby x.Id descending select new { UserId = x.UserId.ToString().Trim(), Name = x.Name.Trim(), Family = x.Family.Trim(), ProfileImage = x.ProfileImage.Trim(), }).ToList(); List <Applicant> result = (from x in query select new Applicant { UserId = x.UserId, ProfileImage = x.ProfileImage }).ToList(); List <string> applicants = new List <string>(); for (int i = 0; i < result.Count(); i++) { applicants.Add(result[i].UserId + "/" + result[i].ProfileImage); } post2.applicants = applicants; post2.isWoman = (bool)post.isWoman; post2.userId = item.UserId.ToString().Trim(); post2.telegram = item.Telegram.ToString().Trim(); post2.instagram = item.Instagram.ToString().Trim(); post2.soroosh = item.Soroosh.ToString().Trim(); post2.gmail = item.Gmail.ToString().Trim(); post2.city = post.city; post2.images = null != post.images.Trim() ? (post.images) : "null"; post2.createDate = BaseSystemModel.ResizeImage.GetDateDifferencesAsDescription(Convert.ToDateTime(post.createDate.ToString()), DateTime.Now, 0); post2.subject = post.subject; post2.latitude = post.latitude.Trim(); post2.longitude = post.longitude.Trim(); post2.state = Dictioanry.GetStatesPayePost[(byte)post.state].ToString() + "-" + Dictioanry.GetStatesDescriptionPayePost[(byte)post.state].ToString() + "-" + Dictioanry.GetStatesColorPayePost[(byte)post.state].ToString(); var user = db.Users.Where(r => r.Id == post.userId).FirstOrDefault(); post2.username = user.Name.Trim() + " " + user.Family.Trim(); post2.token = user.Token.Trim(); if (user.IsShowMobile != null && (bool)user.IsShowMobile) { post2.mobile = user.Mobile.Trim(); } post2.profileimage = Url.Content("~/Images/Users/") + user.ProfileImage + ".jpg"; post2.baseProperty = BaseProperty; return(View(post2)); }