public IActionResult Get() { try { var userData = new UserDemo().UserDemoData(); if (userData != null) { return(Ok(userData)); } else { var notification = new { Type = "error", Message = "Not found anything" }; return(StatusCode(500, notification)); } } catch (Exception ex) { var notification = new { Type = "error", Message = ex.Message }; return(StatusCode(500, notification)); } }
public ActionResult DeleteConfirmed(int id) { UserDemo userdemo = db.UserDemos.Find(id); db.UserDemos.Remove(userdemo); db.SaveChanges(); return(RedirectToAction("Index")); }
// // GET: /user/Delete/5 public ActionResult Delete(int id = 0) { UserDemo userdemo = db.UserDemos.Find(id); if (userdemo == null) { return(HttpNotFound()); } return(View(userdemo)); }
public ActionResult Edit(UserDemo userdemo) { if (ModelState.IsValid) { db.Entry(userdemo).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userdemo)); }
public ActionResult Create(UserDemo userdemo) { if (ModelState.IsValid) { db.UserDemos.Add(userdemo); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userdemo)); }
private static void AccountExamples(string appId) { //Order 示例 OrderDemo.Example(appId); //Order退款示例 OrderRefundDemo.Example("2011708140000074741"); //User 对象相关示例 UserDemo.Example(appId); //用户余额明细示例 BalanceTransactionDemo.Example(appId); //转账 示例 TransferDemo.Example(appId); //余额提现 示例 WithdrawalDemo.Example(appId); //优惠券 示例 CouponDemo.Example(appId); //批量转账 示例 BatchTransferDemo.Example(appId); //批量体现示例 BatchWithdrawalDemo.Example(appId); //子商户示例 SubAppDemo.Example(appId); //子商户渠道设置示例 ChannelDemo.Example(appId, "app_jXH8WHCCSGC0GCGu"); //结算账号示例 SettleAccountDemo.Example(appId); //分润示例 RoyaltyDemo.Example(); //分润结算明细示例 RoyaltyTransactionDemo.Example(); //分润结算示例 RoyaltySettlementDemo.Example(); OrderDemo.Example(appId); var user = UserDemo.Example(appId); BalanceDemo.Example(appId); CouponDemo.Example(appId); //余额充值接口示例 RechargeDemo.Example(appId); //余额赠送示例 BalanceBonusDemo.Example(appId); //余额转账示例 BalanceTransferDemo.Example(appId); //分润模板示例 RoyaltyTemplateDemo.Example(appId); //余额结算对象示例 BalanceSettlementDemo.Example(appId); }
public IActionResult Post([FromBody] UserDemo user) { if (!ModelState.IsValid) { var notification = new { Type = "error", Message = "Data is not valid" }; return(StatusCode(500, notification)); } try { var userData = new UserDemo().UserDemoData(); userData.Add(user); var notification = new { Type = "success", Message = "user added" }; return(Created(string.Empty, notification)); } catch (Exception ex) { var notification = new { Type = "error", Message = ex.Message }; return(StatusCode(500, notification)); } }
static void Main(string[] args) { var select = -1; do { Console.Clear(); Console.WriteLine("Task 02. OOP Basics."); Console.WriteLine("Select the number of a task to check."); Console.WriteLine("1. Round."); Console.WriteLine("2. Triangle."); Console.WriteLine("3. User."); Console.WriteLine("4. My String."); Console.WriteLine("5. Employee."); Console.WriteLine("6. Ring."); Console.WriteLine("7. Vector Graphics Editor."); Console.WriteLine("8. Game."); Console.WriteLine("0. Exit."); if (int.TryParse(Console.ReadLine(), out select)) { switch (select) { case 1: Console.Clear(); Console.WriteLine("Task 2.1. Round."); RoundDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 2: Console.Clear(); Console.WriteLine("Task 2.2. Triangle."); TriangleDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 3: Console.Clear(); Console.WriteLine("Task 2.3. User."); UserDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 4: Console.Clear(); Console.WriteLine("Task 2.4. My String."); MyStringDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 5: Console.Clear(); Console.WriteLine("Task 2.5. Employee."); EmployeeDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 6: Console.Clear(); Console.WriteLine("Task 2.6. Ring."); RingDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 7: Console.Clear(); Console.WriteLine("Task 2.7. Vector Graphics Editor."); Polymorphism.Vector_Graphics_Editor.Editor.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 8: Console.Clear(); Console.WriteLine("Task 2.8. Game."); Polymorphism.Game.GameDemo.Demo(); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; case 0: Console.WriteLine("Good luck!"); Console.WriteLine("Press enter to exit."); break; default: Console.WriteLine("Wrong number. Try again."); Console.WriteLine("Press enter to continue."); Console.ReadLine(); break; } } else { select = -1; Console.WriteLine("Invalid input. Try again."); Console.WriteLine("Press enter to continue."); Console.ReadLine(); } }while (select != 0); Console.ReadLine(); }