public dynamic addSalvationInformation([FromBody] Salvation newSalvation)       //get JSON parameter
        {
            ReviveCommunicationsDBEntities3 db = new ReviveCommunicationsDBEntities3(); //establish database connection

            db.Configuration.ProxyCreationEnabled = false;                              //configure proxy to eliminate overload of data
            dynamic returnMessage = new ExpandoObject();

            //validate that there is no null values
            if (newSalvation != null)
            {
                if (newSalvation.Name == "" || newSalvation.Surname == "" ||
                    newSalvation.Age == "" || newSalvation.EmploymentStatus == "" || newSalvation.MaritualStatus == "")
                {
                    return(returnMessage.Message = "Please make sure that all information is provided under Tell us more about yourself.");
                }
                else if (newSalvation.ResidentialAddress == "" || newSalvation.CellPhone == "" || newSalvation.Email == "" || newSalvation.City == "" || newSalvation.Suburb == "")
                {
                    return(returnMessage.Message = "Please make sure that all information is provided atleast your full residential address, cellphone number and E-mail address.");
                }
                else
                {
                    try
                    {
                        //Set date before saving to database
                        newSalvation.Date = DateTime.Today;
                        //Set follow-up values to false
                        newSalvation.FollowedUp = false;
                        newSalvation.NoAnswer   = false;
                        db.Salvations.Add(newSalvation); //add new salvation to Salvations table
                        db.SaveChanges();

                        return(returnMessage.Message = "All done! We received your information. We really encourage you to visit us again");
                    }
                    catch (Exception)
                    {
                        returnMessage.Message = "Something went wrong! Please try again.";
                        return(returnMessage);
                    }
                }
            }
            else
            {
                return(null);
            }
        }
Beispiel #2
0
 public BaseHealerClass()
 {
     CharacterClassName = "Healer";
     Health             = 20;
     MaxHealth          = 20;
     Attack             = 5;
     Magicattack        = 20;
     Defense            = 5;
     Magicdefense       = 8;
     MaxTech            = 0;
     CurrentMana        = 250;
     MaxMana            = 250;
     ability1           = new NormalAttack();
     ability2           = new Heal();
     ability3           = new Sap();
     ability4           = new DivineLight();
     ability5           = new Salvation();
 }