public ActionResult Registration(UserRegistrations obj) { bool userexist = db.Users.Any(x => x.UserName == obj.UserName); if (userexist) { ViewBag.useridMessage = "This user id already exist - try another"; return(View()); } bool emailexist = db.Users.Any(y => y.UserEmail == obj.UserEmail); if (emailexist) { ViewBag.emailMessage = "This email is already in use - try another"; return(View()); } User u = new User(); { u.UserName = obj.UserName; u.UserPassword = obj.UserPassword; u.UserEmail = obj.UserEmail; u.UserMobile = obj.UserMobile; u.UserCreatedDate = DateTime.Now; db.Users.Add(u); db.SaveChanges(); } ViewBag.RegistrationSuccessful = "Registration Successfully Completed"; return(View()); }
public ActionResult DeleteConfirmed(int id) { UserRegistrations userRegistrations = db.Registrations.Find(id); db.Registrations.Remove(userRegistrations); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "ID,firstName,lastName,deviceIMEI,phoneN,IDnumber,dateOfBirth,emailAddress,gender,phoneIsMine,phoneIsNew,howLongHaveUsedPhone,averageIncome,haveAjob,selfEmployed,student,haveNoIncome,purposeOfLoan,kindOfExpenseForLoan,descriptionForPurposeOfLoan,anyOutstandingLoan")] UserRegistrations userRegistrations) { if (ModelState.IsValid) { db.Entry(userRegistrations).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(userRegistrations)); }
private void HideUserRegistrations(object forecastTypeOption) { var option = forecastTypeOption as OverviewForecastTypeOption; if (option == null || UserRegistrations == null) { return; } UserRegistrations.UpdateForecastTypeForceHide(option); }
// GET: UserRegistrations/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } UserRegistrations userRegistrations = db.Registrations.Find(id); if (userRegistrations == null) { return(HttpNotFound()); } return(View(userRegistrations)); }
private void InitializeCommands() { NextMonthCommand = new DelegateCommand <object>(_ => { SelectedDate = SelectedDate.FirstDayOfNextMonth(); }, x => !IsBusy); PreviousMonthCommand = new DelegateCommand <object>(_ => { SelectedDate = SelectedDate.FirstDayOfPreviousMonth(); }, x => !IsBusy); CurrentMonthCommand = new DelegateCommand <object>(_ => SelectedDate = DateTime.Now.FirstDayOfMonth(), x => !IsBusy); SearchCommand = new DelegateCommand <object>(_ => DoSearchForecasts(), x => !IsBusy); ClearAllCommand = new DelegateCommand <object>(_ => DoClearAll(), x => !IsBusy); PrintCommand = new DelegateCommand <object>(_ => DoPrint(), x => !IsBusy); RemoveUserCommand = new DelegateCommand <object>(x => { var usrMonth = x as ForecastOverviewForecastMonth; if (usrMonth == null) { return; } UserRegistrations.Remove(usrMonth); }, x => !IsBusy); }