public ActionResult Zing(string signed_request) { ZingMe zing = new ZingMe(signed_request); bl_User bluser = new bl_User(); var zingUser = zing.GetInfo(); string userName = zingUser.UserName; var user = bluser.GetByUserName(userName); if (user == null) { var userId = Guid.NewGuid(); bluser.Create(userId, userName, "", false, DateTime.Now); bluser.HardUpdate( userId, zingUser.Avatar160, true, DateTime.Now, zingUser.DisplayName); } else { bluser.HardUpdate( user.UserId, zingUser.Avatar160, user.Gender, user.Birthday, zingUser.DisplayName); } OAuthWebSecurity.CreateOrUpdateAccount("zing", zingUser.Id, userName); FormsAuthentication.SetAuthCookie(userName, true); return(Redirect("/")); }
public ActionResult Create(M_User objUser) { try { bool bAnyError = false; if (ModelState.IsValid) { var vNameExists = _blUser.CheckByNameNEmail(objUser.UserName, objUser.Email); if (vNameExists != null) { if (vNameExists.UserName == objUser.UserName) { ViewBag.ErrorMsg = "User Name alreay exists in our system"; } else if (vNameExists.Email == objUser.Email) { ViewBag.ErrorMsg = "Email alreay exists in our system"; } bAnyError = true; } if (bAnyError == false) { M_User _Obj_M_User = new M_User() { Id = Guid.NewGuid(), Name = objUser.Name, Phone = objUser.Phone, Email = objUser.Email, UserName = objUser.UserName, UserPassword = objUser.UserPassword, RoleId = objUser.RoleId, CreatedBy = _objAuthentication.UserName, CreatedDate = DateTime.Now, }; var vReturnObj = _blUser.Create(_Obj_M_User); } } else { bAnyError = true; } if (bAnyError) { var vRoleList = _blUser.GetRoleList().Select(x => new SelectListItem { Text = x.RoleName, Value = x.Id }); ViewBag.RoleList = vRoleList; return(View(objUser)); } return(RedirectToAction("Index", "User")); } catch (Exception ex) { throw ex; } }