public JsonResult UnBlockedUsers(string checkeds = "", short id = 0) { bool result = false; try { if (id > 0) { if (checkeds.Trim().ToLower() == "true") { checkeds = "1"; } if (checkeds.Trim().ToLower() == "false") { checkeds = "0"; } UnBlockedUsersViewModel model = new UnBlockedUsersViewModel(); model.UnBlockedBy = Convert.ToInt16(Session["TeamMemberRowID"]); model.UnBlockedDate = DateTime.Now; model.WebUserRowID = id; model.Status = Convert.ToByte(checkeds); if (model.UnBlockedBy > 0) { repoWebUser.UnBlockedUser(model); int Res = repoWebUser.SaveChanges(); if (Res > 0) { result = true; // Send_Mail_UnblockedPassword_Client } } else { ViewBag.ErrorMsg = "Invalid Id!"; } } else { ViewBag.ErrorMsg = "Invalid Id!"; } } catch (Exception Ex) { ViewBag.ErrorMsg = Ex.Message; clsCommonMethods.ErrorLog(Server.MapPath("~\\ErrorLogs\\Logfiles"), Ex.Message, Ex.StackTrace); } return(Json(new { result }, JsonRequestBehavior.AllowGet)); }
public void UnBlockedUser(UnBlockedUsersViewModel model) { try { if (model.WebUserRowID != 0) { db.WebUsers.Single(b => b.WebUserRowID == model.WebUserRowID).UnBlockedBy = model.UnBlockedBy; db.WebUsers.Single(b => b.WebUserRowID == model.WebUserRowID).UnBlockedDate = model.UnBlockedDate; db.WebUsers.Single(b => b.WebUserRowID == model.WebUserRowID).Status = model.Status; } else { throw new Exception("Web User could not be blank!"); } } catch (Exception) { throw; } }