public ActionResult MyProfile(int id) { var objRegistrationRepository = new RegistrationRepository(); RegistrationViewModel objEntity = null; objEntity = objRegistrationRepository.Select(RegistrationFlags.SelectByID.GetHashCode(), new RegistrationViewModel() { RegistrationId = id }).FirstOrDefault(); if (objEntity == null) { this.Flash("error", "Failed to show my profile"); return RedirectToAction("Index"); } return View(objEntity); }
public ActionResult ProfileEdit(int id) { var objRegistrationRepository = new RegistrationRepository(); var objEntity = new RegistrationViewModel(); var objUpdateEntity = new RegistrationUpdateViewModel(); objEntity = objRegistrationRepository.Select(RegistrationFlags.SelectByID.GetHashCode(), new RegistrationViewModel() { RegistrationId = id }).FirstOrDefault(); if (objEntity == null) { this.Flash("error", "Failed to edit profile details"); return RedirectToAction("Dashboard"); } objUpdateEntity.RegistrationId = objEntity.RegistrationId; objUpdateEntity.UserId = objEntity.UserId; objUpdateEntity.FirstName = objEntity.FirstName; objUpdateEntity.LastName = objEntity.LastName; objUpdateEntity.PhotoName = objEntity.PhotoName; objUpdateEntity.DateOfBirth = objEntity.DateOfBirth; objUpdateEntity.Gender = objEntity.Gender; objUpdateEntity.Location = objEntity.Location; objUpdateEntity.MobileNumber = objEntity.MobileNumber; return View(objUpdateEntity); }
// GET: /Employee1/ // [UserAuthorized] public ActionResult Index() { var objRegistrationRepository = new RegistrationRepository(); List<RegistrationViewModel> objEntityList = objRegistrationRepository.Select(RegistrationFlags.SelectAll.GetHashCode(), new RegistrationViewModel() { }); if (objEntityList.Count == 0) { this.Flash("error", "No accounts"); } return View(objEntityList); }