Advertisement
Guest User

Untitled

a guest
Jul 12th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.53 KB | None | 0 0
  1.    
  2.  
  3.         [Authorize]
  4.         public ActionResult PayModel(string name)
  5.         {
  6.             int totalcount = 0;
  7.  
  8.             //display amount owed
  9.             MembershipUser user = Membership.GetUser(name);
  10.             var bookings = BC.GetOwedModelBookings(user.UserName, user.Email);
  11.  
  12.  
  13.             foreach (var xxx in bookings)
  14.             {
  15.  
  16.                 if (xxx.state == "Complete")
  17.                     totalcount += Convert.ToInt32(xxx.calculate_earning());
  18.             }
  19.  
  20.  
  21.             if (bookings != null && (User.IsInRole("admin") || User.IsInRole("model")))
  22.             {
  23.                 ViewData["totalcount"] = totalcount;
  24.                 return View(bookings);
  25.             }
  26.             else
  27.             {
  28.                 return View("Fail");
  29.             }
  30.  
  31.         }
  32.  
  33.  
  34.         [AcceptVerbs(HttpVerbs.Post)]
  35.         public ActionResult PayModel(string name, FormCollection formValues)
  36.         {
  37.  
  38.             MembershipUser user = Membership.GetUser(name);
  39.             var bookings = BC.GetOwedModelBookings(user.UserName, user.Email);
  40.  
  41.             if (bookings != null)
  42.             {
  43.                 foreach (var xcounter in bookings)
  44.                 {
  45.  
  46.                     if (xcounter.state == "Complete")
  47.                         xcounter.state = "Resolved";
  48.  
  49.                 }
  50.                 BC.Save();
  51.  
  52.  
  53.  
  54.                 return RedirectToAction("allnotes");
  55.             }
  56.             else
  57.             {
  58.                 return RedirectToAction("Fail");
  59.             }
  60.  
  61.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement