You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
	
	
		
		
			
	
	
		
			
				
					
						
							|  |  |  | using System; | 
					
						
							|  |  |  | using System.Web.Mvc; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | using Pingchuan.BeijingSafeguard.BLL; | 
					
						
							|  |  |  | using Pingchuan.BeijingSafeguard.Model; | 
					
						
							|  |  |  | using Pingchuan.BeijingSafeguard.Utility; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Pingchuan.BeijingSafeguard.App.Controllers | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     public class UserController : BaseController | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         public ActionResult Login() | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             return View(); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         [HttpPost] | 
					
						
							|  |  |  |         public JsonResult Login(string name, string password) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             User user = UserBLL.GetUser(name, Helper.CalcMD5(password)); | 
					
						
							|  |  |  |             if (user != null) | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |                 SetLoginUser(user); | 
					
						
							|  |  |  |                 UpdateLoginInformation(user); | 
					
						
							|  |  |  |             } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             return Json(user != null); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         private void UpdateLoginInformation(User user) | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |             user.LoginCount += 1; | 
					
						
							|  |  |  |             user.LastLoginTime = DateTime.Now; | 
					
						
							|  |  |  |             UserBLL.Update(user); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |