public ActionResult ThayDoiTrangThaiThanhToan(int id, int idtrangthai) { rs r; try { DonHang DonHang = __db.DonHangs.Find(id); DonHang.TrangThaiThanhToanId = idtrangthai; DonHang.ModifiedDate = DateTime.Now; __db.SaveChanges(); if (idtrangthai == 2) { OneSignalAPI.SendMsgToUser("Đơn hàng: TH" + DonHang.Id, "Tính tiền thành công!", DonHang.UniqueID); } else if (idtrangthai == 3) { OneSignalAPI.SendMsgToUser("Đơn hàng: TH" + DonHang.Id, "Đã hủy!", DonHang.UniqueID); } r = rs.T("Ok"); } catch (Exception ex) { r = rs.F("Lỗi: " + ex.Message); } return(Json(r, JsonRequestBehavior.DenyGet)); }
public ContentResult SendOneSignal() { OneSignalAPI api = new OneSignalAPI(); string msgr = "ax";// api.SendMsg(); return(Content(msgr)); }
public JsonResult ajax_reply(ReplyPhanHoiForm model) { rs r; if (ModelState.IsValid) { try { var donhang = __db.DonHangs.Find(model.DonHangId); var quan = donhang.Quan; var __auth = MySsAuthUsers.GetAuth(); var newRep = new GopYReply() { GopYId = model.GopYId, NoiDung = model.NoiDungPhanHoi, UserReplyId = __auth.ID, }; __db.GopYReply.Add(newRep); __db.SaveChanges(); OneSignalAPI.SendMsgToUser(quan.TenQuan + " #TH" + donhang.Id, model.NoiDungPhanHoi, donhang.UniqueID); r = rs.T("Đã phản hồi thành công!"); } catch (Exception ex) { r = rs.F("Lỗi: " + ex.Message); } } else { r = rs.F("Lỗi, vui lòng thử lại. " + string.Join(";", ModelState.Values .SelectMany(x => x.Errors) .Select(x => x.ErrorMessage).Distinct())); } return(Json(r, JsonRequestBehavior.DenyGet)); }