Пример #1
0
		public async Task Index()
		{
			var name = Context.User.Identity.Name;
			var user = await db.Users.FirstOrDefaultAsync( c => c.UserName == name );
			var UserViewModel = new UserView( user );
			Clients.Caller.indexBack( UserViewModel );
		}
Пример #2
0
		public async Task RetreaterAppSubmit(UserInput model)
		{
			var User = await this.User();

			if ( User.Retreater)
			{
				Clients.Caller.errorBack("You are already attending this retreat.");
			}
			else if(User.Staffer )
			{
				Clients.Caller.errorBack("You are already staffing this retreat.");
			}
			else if(User.RetreaterPending)
			{
				Clients.Caller.errorBack("You have already submitted your retreat application.");
			}
			else if(User.StafferPending)
			{
				Clients.Caller.errorBack("You have already submitted your staffer application.");
			}
			else
			{
				User.RetreaterPending = true;

				User.Personal.FirstName = model.Personal.FirstName;
				User.Personal.LastName = model.Personal.LastName;
				User.Personal.Email = model.Personal.Email;
				User.Personal.Phone = new Models.Phone();
				User.Personal.Phone.Number = model.Personal.Phone.Number;
				User.Personal.Phone.Carrier = await db.Carriers.FindAsync(model.Personal.Phone.Carrier);
				User.Personal.Hobbies = model.Personal.Hobbies;
				User.Personal.TShirtSize = await db.TShirtSizes.FindAsync( model.Personal.TShirtSize );

				User.Religion.FavoriteBibleVerse = model.Religion.FavoriteBibleVerse;
				User.Religion.FavoriteSaint = model.Religion.FavoriteSaint;
				User.Religion.Reason = model.Religion.Reason;
				User.Religion.RoleModel = model.Religion.RoleModel;
				User.Religion.PrayerRequest = model.Religion.PrayerRequest;

				User.School.College = model.School.College;
				User.School.Grade = await db.Grades.FindAsync( model.School.Grade );

				User.Medical.Allergies = model.Medical.Allergies;
				User.Medical.HealthConditions = model.Medical.HealthConditions;

				User.Emergency.FirstName = model.Emergency.FirstName;
				User.Emergency.LastName = model.Emergency.LastName;
				User.Emergency.Email = model.Emergency.Email;
				User.Emergency.Phone = new Models.Phone();
				User.Emergency.Phone.Number = model.Emergency.Phone.Number;
				User.Emergency.Phone.Carrier = await db.Carriers.FindAsync( model.Emergency.Phone.Carrier );

				User.Transportation.TransportSelf = model.Transportation.TransportSelf;

				await db.SaveChangesAsync();
				var userView = new UserView(User);
				Clients.Caller.submitRetreatBack( userView );
			}
		}
Пример #3
0
 public UserInput(UserView model)
 {
     this.Roles = new Collection<RoleInput>();
     foreach(var role in model.Roles)
     {
         this.Roles.Add(new RoleInput(role));
     }
     this.Fee = model.Fee;
     this.FeePaid = model.FeePaid;
     this.Personal = new PersonalInput(model.Personal);
     this.School = new SchoolInput(model.School);
     this.Medical = new MedicalInput(model.Medical);
     this.Religion = new ReligionInput(model.Religion);
     this.Emergency = new EmergencyInput(model.Emergency);
     this.Transportation = new TransportationInput(model.Transportation);
     this.Staff = new StaffInput( model.Staff );
     this.Position = model.Position;
     if ( model.ApplicationStamp != null )
     this.ApplicationStamp = model.ApplicationStamp;
 }