Exemple #1
0
 public People(string name, int age, EmotionalState attitude, FavoriteColor color)
 {
     _name     = name;
     _age      = age;
     _attitude = attitude;
     _color    = color;
 }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            FavoriteColor favoriteColor = db.FavoriteColors.Find(id);

            db.FavoriteColors.Remove(favoriteColor);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "FavoriteColorID,FavoriteColor1")] FavoriteColor favoriteColor)
 {
     if (ModelState.IsValid)
     {
         db.Entry(favoriteColor).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(favoriteColor));
 }
Exemple #4
0
        public ActionResult Create([Bind(Include = "FavoriteColorID,FavoriteColor1")] FavoriteColor favoriteColor)
        {
            if (ModelState.IsValid)
            {
                db.FavoriteColors.Add(favoriteColor);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(favoriteColor));
        }
        public IActionResult ColorList()
        {
            FavoriteColor colorlist = new FavoriteColor();

            colorlist.FirstColor  = "Purple";
            colorlist.SecondColor = "Yellow";
            colorlist.ThirdColor  = "Green";


            return(View(colorlist));
        }
Exemple #6
0
        public bool Equals(Person other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            return(LastName.Equals(other.LastName) &&
                   FirstName.Equals(other.FirstName) &&
                   Gender.Equals(other.Gender) &&
                   FavoriteColor.Equals(other.FavoriteColor) &&
                   DateOfBirth.Equals(other.DateOfBirth));
        }
Exemple #7
0
        // GET: FavoriteColors/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FavoriteColor favoriteColor = db.FavoriteColors.Find(id);

            if (favoriteColor == null)
            {
                return(HttpNotFound());
            }
            return(View(favoriteColor));
        }
Exemple #8
0
    // Append new objects to your file
    private async Task Append()
    {
        // Read file content and deserialize
        string content = await ReadAsync("json.txt");

        var colors = new List <FavoriteColor>();

        if (!string.IsNullOrWhiteSpace(content))
        {
            colors.AddRange(JsonConvert.DeserializeObject <List <FavoriteColor> >(content));
        }
        // Add your new favorite color!
        var fav = new FavoriteColor("new", "new color");

        colors.Add(fav);
        // Writo back to file
        await WriteAsync("json.txt", JsonConvert.SerializeObject(colors));
    }
 public MiiDataWii(MiiCharacter mii)
 {
     #region Unknown Data
     this.unknown_1  = 0;
     this.unknown_2  = false;
     this.unknown_3  = 0;
     this.unknown_4  = 0;
     this.unknown_5  = 0;
     this.unknown_6  = 0;
     this.unknown_7  = 0;
     this.unknown_8  = 0;
     this.unknown_9  = 0;
     this.unknown_10 = 0;
     this.unknown_11 = false;
     #endregion
     SuperMii.SuperMiiData data = mii.data;
     #region Basics
     SuperMii.Basics basics = data.basics;
     this.invalid        = false;
     this.mii_name       = basics.nickname;
     this.female         = basics.is_female;
     this.birth_month    = basics.birth_month;
     this.birth_day      = basics.birth_day;
     this.favorite_color = (FavoriteColor)SuperMiiData.ApproximateColor(Favorite.colors, basics.favorite_color);
     this.favorite       = basics.favorite;
     this.creator_name   = basics.creator_name;
     #endregion
     #region Body
     SuperMii.Body body = data.body;
     this.body_height = (sbyte)SuperMiiData.Denormalize(body.height, 127);
     this.body_weight = (sbyte)SuperMiiData.Denormalize(body.weight, 127);
     #endregion
     #region Identifiers
     // FIXME: This will cause issues on real hardware!
     this.mii_id    = 0;
     this.client_id = 0;
     #endregion
     #region Metadata
     this.dontMingle = true;
     this.downloaded = true;
     #endregion
     #region Face
     SuperMii.Face face = data.face;
     this.face_shape = face.type;
     this.skin_color = face.type;
     // Facial feature
     if (face.wrinkles == 0)
     {
         this.facial_feature = (byte)face.makeup;
     }
     else if (face.makeup == 0)
     {
         this.facial_feature = (byte)(face.wrinkles + 4);
     }
     else
     {
         // TODO add a way for the user to select either wrinkles or makeup
         this.facial_feature = 0;
     }
     #endregion
     #region Hair
     SuperMii.Hairstyle hair = data.hair;
     this.hair_type  = (sbyte)hair.type;
     this.hair_color = (sbyte)SuperMiiData.ApproximateColor(Hairstyle.colors, hair.color);
     this.hair_flip  = hair.flipped;
     #endregion
     #region Eyebrows
     SuperMii.Eyebrows eyebrows = data.eyebrows;
     this.eyebrow_type       = (uint)eyebrows.type;
     this.eyebrow_rotation   = SuperMiiData.Denormalize(eyebrows.rotation, 11);
     this.eyebrow_color      = SuperMiiData.ApproximateColor(Eyebrows.colors, eyebrows.color);
     this.eyebrow_size       = SuperMiiData.Denormalize(eyebrows.size, 8);
     this.eyebrow_vertical   = SuperMiiData.Denormalize(eyebrows.verticalPosition, 3, 18);
     this.eyebrow_horizontal = SuperMiiData.Denormalize(eyebrows.horizontalSpread, 0, 12);
     #endregion
     #region Eyes
     SuperMii.Eyes eyes = data.eyes;
     this.eye_type       = (byte)eyes.type;
     this.eye_rotation   = SuperMiiData.Denormalize(eyes.rotation, 7);
     this.eye_vertical   = SuperMiiData.Denormalize(eyes.verticalPosition, 18);
     this.eye_color      = SuperMiiData.ApproximateColor(Eyes.colors, eyes.color);
     this.eye_size       = SuperMiiData.Denormalize(eyes.size, 7);
     this.eye_horizontal = SuperMiiData.Denormalize(eyes.spread, 12);
     #endregion
     #region Nose
     SuperMii.Nose nose = data.nose;
     this.nose_type     = (byte)nose.type;
     this.nose_size     = (byte)SuperMiiData.Denormalize(nose.size, 8);
     this.nose_vertical = (byte)SuperMiiData.Denormalize(nose.verticalPosition, 18);
     #endregion
     #region Mouth
     SuperMii.Mouth mouth = data.mouth;
     this.mouth_type     = (byte)mouth.type;
     this.mouth_color    = (byte)SuperMiiData.ApproximateColor(Mouth.colors, mouth.color);
     this.mouth_size     = (byte)SuperMiiData.Denormalize(mouth.size, 8);
     this.mouth_vertical = (byte)SuperMiiData.Denormalize(mouth.verticalPosition, 18);
     #endregion
     #region Glasses
     SuperMii.Glasses glasses = data.glasses;
     this.glasses_type     = (byte)glasses.type;
     this.glasses_color    = (byte)SuperMiiData.ApproximateColor(Glasses.colors, glasses.color);
     this.glasses_size     = (byte)SuperMiiData.Denormalize(glasses.size, 7);
     this.glasses_vertical = (byte)SuperMiiData.Denormalize(glasses.verticalPosition, 20);
     #endregion
     #region Facial hair
     SuperMii.FacialHair facial_hair = data.facial_hair;
     this.facial_hair_mustache = (byte)facial_hair.moustache;
     this.facial_hair_beard    = (byte)facial_hair.beard;
     this.facial_hair_color    = (byte)SuperMiiData.ApproximateColor(FacialHair.colors, facial_hair.color);
     this.facial_hair_size     = (byte)SuperMiiData.Denormalize(facial_hair.size, 8);
     this.facial_hair_vertical = (byte)SuperMiiData.Denormalize(facial_hair.verticalPosition, 16);
     #endregion
     #region Mole
     SuperMii.Mole mole = data.mole;
     this.mole_enable     = mole.enabled;
     this.mole_size       = (byte)SuperMiiData.Denormalize(mole.size, 8);
     this.mole_vertical   = (byte)SuperMiiData.Denormalize(mole.verticalPosition, 30);
     this.mole_horizontal = (byte)SuperMiiData.Denormalize(mole.horizontalPosition, 16);
     #endregion
 }
Exemple #10
0
        // GET: Customers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Customer      customer      = db.Customers.Find(id);
            FavoriteColor favoriteColor = db.FavoriteColors.Find(customer.FavoriteColorID);
            BirthMonth    birthMonth    = db.BirthMonths.Find(customer.BirthMonthID);

            if (customer == null)
            {
                return(HttpNotFound());
            }

            //Set model fields equal to variables used in old fortune teller project
            int    userAgeNum    = customer.Age;
            int    siblingNum    = customer.NumberOfSiblings;
            string favColor      = favoriteColor.FavoriteColor1.ToLower();
            int    birthMonthNum = birthMonth.BirthMonthNum;


            //Filter information from user input through conditional statements to get fortune results.
            //User Age translated into years until retirement.
            if (userAgeNum % 2 == 0)
            {
                ViewBag.RetirementText = "20 years";
            }
            else
            {
                ViewBag.RetirementText = "5 years";
            }

            //Number of Siblings coverted to vacation home location
            if (siblingNum == 0)
            {
                ViewBag.VacationHome = "a Quechuan-style cottage high in the Andes";
            }
            else if (siblingNum > 0 && siblingNum <= 1)
            {
                ViewBag.VacationHome = "a houseboat on the French Riviera";
            }
            else if (siblingNum > 1 && siblingNum <= 2)
            {
                ViewBag.VacationHome = "a Tibetan Monestary";
            }
            else if (siblingNum > 2 && siblingNum <= 3)
            {
                ViewBag.VacationHome = "an igloo in Nunavut, Canada";
            }
            else if (siblingNum > 3)
            {
                ViewBag.VacationHome = "a penthouse in NYC";
            }
            else
            {
                ViewBag.VacationHome = "a trunk shipped to Timbuktu";
            }

            //Favorite color determines mode of transport.
            switch (favColor)
            {
            case "red":
                ViewBag.ModeTransport = "1962 250 GT Lusso Berlinetta";
                break;

            case "orange":
                ViewBag.ModeTransport = "Jetta";
                break;

            case "yellow":
                ViewBag.ModeTransport = "custom diesel rocketship (the aerial companion to the Yellow Submarine)";
                break;

            case "green":
                ViewBag.ModeTransport = "llama (if he talks, beware! You may have found an emperor...)";
                break;

            case "blue":
                ViewBag.ModeTransport = "Nightfury (do you even have to park a dragon? I hope not!)";
                break;

            case "indigo":
                ViewBag.ModeTransport = "1960's motorhome";
                break;

            case "violet":
                ViewBag.ModeTransport = "flying carpet (it's a whole new world!)";
                break;

            default:
                ViewBag.ModeTransport = "dog sled (time to get creative!)";
                break;
            }

            //birth month number determines the amount of money in the bank.
            if (birthMonthNum >= 1 && birthMonthNum <= 4)
            {
                ViewBag.MoneyInBank = 1.40;
            }
            else if (birthMonthNum >= 5 && birthMonthNum <= 8)
            {
                ViewBag.MoneyInBank = 1000000000;
            }
            else if (birthMonthNum >= 9 && birthMonthNum <= 12)
            {
                ViewBag.MoneyInBank = 50000;
            }
            else
            {
                ViewBag.MoneyInBank = 0.00;
            }


            return(View(customer));
        }
Exemple #11
0
 public override string ToString()
 {
     return(string.Format("{0, -15} {1, -15} {2, -10} {3, -15} {4:M/d/yyyy}", FirstName.Trim(), LastName.Trim(), Gender.Trim(), FavoriteColor.Trim(), DateOfBirth));
 }
Exemple #12
0
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = 13;

                hashCode = hashCode ^ LastName.GetHashCode() ^ FirstName.GetHashCode() ^ Gender.GetHashCode() ^ FavoriteColor.GetHashCode() ^ DateOfBirth.GetHashCode();
                return(hashCode);
            }
        }