public ActionResult Details(string id) { UserStatusViewModel candidateVM = new UserStatusViewModel(); UserStatusDTO userStatus = candidateVM.GetUserStatusDetailsById(id); return(View(userStatus)); }
public List <UserStatusDTO> GetAllUserStatus() { List <UserStatusDTO> list = new List <UserStatusDTO>(); using (sqlconn) { using (SqlCommand cmd = new SqlCommand("SelectAllUserStatusDescription", sqlconn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; sqlconn.Open(); using (SqlDataReader rdr = cmd.ExecuteReader()) { while (rdr.Read()) { UserStatusDTO objUserStatusDTO = new UserStatusDTO { UserStatusID = rdr["UserStatusID"].ToString(), Description = rdr["Description"].ToString() }; list.Add(objUserStatusDTO); } } } } return(list); }
public ActionResult Create(UserStatusDTO paramUserStatusDTO) { try { if (paramUserStatusDTO == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //var Name = paramCandidateDTO.UserPic; var Description = paramUserStatusDTO.Description.Trim(); using (sqlconn) { using (SqlCommand cmd = new SqlCommand("InsertIntoUserStatusTable", sqlconn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Description", Description); sqlconn.Open(); cmd.ExecuteNonQuery(); sqlconn.Close(); } } return(Redirect("~/UserStatus/Create")); } catch (Exception ex) { ModelState.AddModelError(string.Empty, "Error: " + ex); return(View("Create")); } }
public ActionResult Edit(string id) { UserStatusViewModel userStatus = new UserStatusViewModel(); UserStatusDTO status = userStatus.GetUserStatusDetailsById(id); return(View(status)); }
public IActionResult CreateStatus([FromBody] UserStatusDTO info) { UserStatusDTO response = statusRepository.CreateStatus(info); if (response != null) { return(new ObjectResult(response)); } else { return(new BadRequestObjectResult("Try again, you missed some of the needed informations.")); } }
public ActionResult GetUser(int?id) { try { UserStatusDTO status = userService.GetStatus(id); var order = new UserViewModel { StatusId = status.Id }; return(View(order)); } catch (ValidationException ex) { return(Content(ex.Message)); } }
public UserStatusDTO GetUserStatus() { //Dbop.Close(); int totalCount = Dbop.GetCount(); var banCount = ServerContext.ServerConfig.BoundConfig.UsersBanlist.Count; var onlineCount = ServerContext.Clients.Count(); var restCount = totalCount - banCount - onlineCount; UserStatusDTO dto = new UserStatusDTO { onlineUsersCount = onlineCount, offlineUsersCount = restCount, banUsersCount = banCount }; return(dto); }
public UserStatusDTO CreateStatus(UserStatusCreate info) { StoreContext db = new StoreContext(); UserStatus UserStatus = mapper.Map <UserStatus>(info); if (UserStatus != null) { db.UserStatus.Add(UserStatus); db.SaveChanges(); UserStatusDTO response = mapper.Map <UserStatusDTO>(UserStatus); return(response); } else { return(null); } }
public ActionResult Edit(UserStatusDTO objeUserStatus) { if (ModelState.IsValid) { using (sqlconn) { using (SqlCommand cmd = new SqlCommand("UpdateUserStatusDetails", sqlconn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@UserStatusID", objeUserStatus.UserStatusID); cmd.Parameters.AddWithValue("@Description", objeUserStatus.Description); sqlconn.Open(); cmd.ExecuteNonQuery(); sqlconn.Close(); } } } return(View()); }
public UserStatusDTO GetUserStatusDetailsById(string id) { // get userStatus id from the model UserStatusDTO paramUserStatusDTO = new UserStatusDTO(); using (sqlconn) { using (SqlCommand cmd = new SqlCommand("SelecOneDescription", sqlconn)) { cmd.CommandType = System.Data.CommandType.StoredProcedure; sqlconn.Open(); cmd.Parameters.AddWithValue("@UserStatusID", id); using (SqlDataReader rdr = cmd.ExecuteReader()) { rdr.Read(); paramUserStatusDTO.UserStatusID = rdr["UserStatusID"].ToString(); paramUserStatusDTO.Description = rdr["Description"].ToString(); } } } return(paramUserStatusDTO); }
public UserNoPasswordDTO() { status = UserStatusDTO.ENABLED; }
public ActionResult Create() { UserStatusDTO userStatusDTO = new UserStatusDTO(); return(View(userStatusDTO)); }