예제 #1
0
        public ActionResult Edit(Carpenter carpenter, string Id, HttpPostedFileBase file)
        {
            Carpenter carpenterToEdit = context.Find(Id);

            if (carpenterToEdit == null)
            {
                return(HttpNotFound());
            }
            else
            {
                if (!ModelState.IsValid)
                {
                    return(View(carpenter));
                }
                if (file != null)
                {
                    carpenter.Image = carpenter.Id + Path.GetExtension(file.FileName);
                    file.SaveAs(Server.MapPath("//Content//CarpenterImages//") + carpenter.Image);
                }

                carpenterToEdit.Category    = carpenter.Category;
                carpenterToEdit.Description = carpenter.Description;
                carpenterToEdit.Name        = carpenter.Name;
                carpenterToEdit.Price       = carpenter.Price;


                context.Commit();

                return(RedirectToAction("Index"));
            }
        }
예제 #2
0
    public void ConfirmSelection()
    {
        people[selectedPerson].Spawn();
        switch (Random.Range(0, 4))
        {
        case 0:
            people[selectedPerson] = new Warrior("Jon");
            break;

        case 1:
            people[selectedPerson] = new Cook("Jon");
            break;

        case 2:
            people[selectedPerson] = new Smith("Jon");
            break;

        case 3:
            people[selectedPerson] = new Carpenter("Jon");
            break;
        }

        choices[selectedPerson].transform.GetChild(0).GetChild(0).GetComponent <TextMeshProUGUI>().text = people[selectedPerson].personName;
        choices[selectedPerson].transform.GetChild(0).GetChild(1).GetComponent <TextMeshProUGUI>().text = people[selectedPerson].GetType().ToString();
        choices[selectedPerson].transform.GetChild(2).GetComponent <TextMeshProUGUI>().text             = people[selectedPerson].originalStats.ToString();

        choices[selectedPerson].GetComponent <Image>().color = new Color(1, 1, 1, 100f / 255f);
        gameObject.SetActive(false);
    }
    protected override SkiaChart WieldTool(ProgressTask task, HammerSettings settings)
    {
        var carpenter = new Carpenter(_httpClient, task, settings);
        var results   = carpenter.Run();

        var averages = results.ToDictionary(r => r.Key, r => r.Value.Mean);

        return(new LineChart(averages));
    }
예제 #4
0
        static void Main()
        {
            Carpenter carpenter = new Carpenter();
            var       table     = carpenter.CreateTable().WithLegsMaterial("wooden").WithTopMaterial("glass").Build();

            Console.WriteLine($"table with {table.Legs} legs and {table.Top} top");

            Console.ReadKey();
        }
예제 #5
0
        static void Main()
        {
            Carpenter carpenter = new Carpenter();
            var       table     = carpenter.CreateTable(new WoodenTableBuilder());

            Console.WriteLine(table.Legs + " " + table.Top);

            table = carpenter.CreateTable(new IronTableBuilder());
            Console.WriteLine(table.Legs + " " + table.Top);

            Console.ReadKey();
        }
예제 #6
0
        public ActionResult Delete(String Id)
        {
            Carpenter carpenterToDelete = context.Find(Id);

            if (carpenterToDelete == null)
            {
                return(HttpNotFound());
            }
            else
            {
                return(View(carpenterToDelete));
            }
        }
예제 #7
0
        public void Delete(string Id)
        {
            Carpenter carpenterToDelete = carpenters.Find(p => p.Id == Id);

            if (carpenterToDelete != null)
            {
                carpenters.Remove(carpenterToDelete);
            }
            else
            {
                throw new Exception("Carpenter not found");
            }
        }
예제 #8
0
        public Carpenter Find(string Id)
        {
            Carpenter carpenter = carpenters.Find(p => p.Id == Id);

            if (carpenter != null)
            {
                return(carpenter);
            }
            else
            {
                throw new Exception("Carpenter no found");
            }
        }
예제 #9
0
        public void Update(Carpenter carpenter)
        {
            Carpenter carpenterToUpdate = carpenters.Find(p => p.Id == carpenter.Id);

            if (carpenterToUpdate != null)
            {
                carpenterToUpdate = carpenter;
            }
            else
            {
                throw new Exception("Carpenter no found");
            }
        }
예제 #10
0
        public ActionResult ConfirmDelete(string Id)
        {
            Carpenter carpenterToDelete = context.Find(Id);

            if (carpenterToDelete == null)
            {
                return(HttpNotFound());
            }
            else
            {
                context.Delete(Id);
                context.Commit();
                return(RedirectToAction("Index"));
            }
        }
예제 #11
0
        public ActionResult Edit(String Id)
        {
            Carpenter carpenter = context.Find(Id);

            if (carpenter == null)
            {
                return(HttpNotFound());
            }
            else
            {
                ProductManagerViewModel viewModel = new ProductManagerViewModel();
                viewModel.Carpenter         = carpenter;
                viewModel.ProductCategories = productCategories.Collection();

                return(View(viewModel));
            }
        }
예제 #12
0
        public ActionResult Create(Carpenter carpenter, HttpPostedFileBase file)
        {
            if (!ModelState.IsValid)
            {
                return(View(carpenter));
            }
            else
            {
                if (file != null)
                {
                    carpenter.Image = carpenter.Id + Path.GetExtension(file.FileName);
                    file.SaveAs(Server.MapPath("//Content//CarpenterImages//") + carpenter.Image);
                }

                context.Insert(carpenter);
                context.Commit();

                return(RedirectToAction("Index"));
            }
        }
예제 #13
0
 public void Activate(Carpenter carpenter)
 {
     gameObject.SetActive(true);
     transform.position = carpenter.transform.position + Vector3.right * 1.15f + Vector3.up;
     currentCarpenter   = carpenter;
 }
예제 #14
0
 public void Insert(Carpenter p)
 {
     carpenters.Add(p);
 }