Exemplo n.º 1
0
        public ActionResult Delete(int id)
        {
            ViewBag.ElectronicId = id;
            Electronic electronic = db.Electronics.FirstOrDefault(a => a.Id == id);

            return(View(electronic));
        }
 // Entity yükleme
 protected override void Load(DomainObject obj, DataRow row)
 {
     // Base mapper çağır veriyi yükle
     base.Load(obj, row);
     // Movies entity özelliklerini yükleme
     Electronic electronic = (Electronic)obj;
 }
Exemplo n.º 3
0
        public ActionResult CreateElectronic(CreateViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                var createViewModel = new CreateViewModel()
                {
                    CategoryClother = _context.CategoryClothers.ToList()
                };
                ViewBag.Action = "Electronic";
                return(View("~/Views/Shared/CreateViewModel.cshtml", createViewModel));
            }

            var electronic = new Electronic()
            {
                Name                 = viewModel.Name,
                Description          = viewModel.Description,
                Price                = viewModel.Price,
                PriceReduce          = viewModel.PriceReduce,
                Imageurl             = viewModel.ImageUrl,
                CategoryElectronicId = viewModel.CategoryId
            };

            _context.Electronics.Add(electronic);
            _context.SaveChanges();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public static async Task <Electronic> GetElectronicAsync(ApplicationDbContext _context, int ProductId)
        {
            Electronic electronic = await(from elect in _context.Electronics
                                          where elect.ProductId == ProductId
                                          select elect).SingleAsync();

            return(electronic);
        }
Exemplo n.º 5
0
        public async Task <IActionResult> DeleteElectronic(int id)
        {
            Electronic elect = await ElectronicsDb.GetElectronicAsync(_context, id);

            _context.Entry(elect).State = EntityState.Deleted;
            await _context.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(Electronic elect)
        {
            if (ModelState.IsValid)
            {
                _context.Entry(elect).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
                await _context.SaveChangesAsync();
            }

            return(RedirectToAction("Index"));
        }
        // GET: Elec_water/Create
        public ActionResult Create()
        {
            var roomModel = new Electronic();

            roomModel.roomlist = from r in db.booking
                                 where r.status == "verified"
                                 select r;

            return(View(roomModel));
        }
Exemplo n.º 8
0
        public ActionResult Delete(int id)
        {
            Electronic electronic = db.Electronics.Where(a => a.Id == id).FirstOrDefault();

            if (electronic != null)
            {
                GetCart().RemoveLine(electronic);
            }
            return(RedirectToAction("Cart", "Cart"));
        }
Exemplo n.º 9
0
        public ActionResult Add(int id)
        {
            Electronic electronic = db.Electronics.Where(a => a.Id == id).FirstOrDefault();

            if (electronic != null)
            {
                GetCart().AddItem(electronic, 1);
            }
            return(RedirectToAction("Catalog", "Catalog"));
        }
Exemplo n.º 10
0
        public async Task <IActionResult> Add(Electronic elect)
        {
            if (ModelState.IsValid)
            {
                elect.TimeCreated = System.DateTime.Now;
                await ElectronicsDb.AddElectronicAsync(_context, elect);

                return(RedirectToAction("Index"));
            }

            return(View());
        }
Exemplo n.º 11
0
 public ActionResult Add(Electronic electronic, HttpPostedFileBase upload, int categoryId)
 {
     if (upload != null)
     {
         string path = "/Pictures/" + upload.FileName;
         upload.SaveAs(Server.MapPath(path));
         electronic.ImagePath = path;
         electronic.Category  = db.Categories.First(a => a.Id == categoryId);
         db.Electronics.Add(electronic);
         db.SaveChanges();
     }
     return(RedirectToAction("Edit"));
 }
 public ActionResult Create([Bind(Include = "Id,room_id,meter,date,month")] Electronic electronic)
 {
     try
     {
         db.Electronic.Add(electronic);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(electronic));
     }
 }
Exemplo n.º 13
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Fire"))
        {
            sp.enabled             = false;
            transform.position     = other.transform.position;
            rigidbody.gravityScale = 0;
            rigidbody.velocity     = Vector2.zero;
            Possess _possess = other.GetComponent <Possess>();
            if (_possess != null)
            {
                possess = _possess;
                possess.PossessObject();
                transform.position = (Vector2)possess.eyePos.position + Vector2.down;
            }

            pg = other.GetComponent <Progress>();
            if (pg != null)
            {
                pg.possessedPos    = transform;
                pg.bPossess        = true;
                transform.position = pg.startPos.position;
                eyeSP.enabled      = false;
            }

            Electronic et = other.GetComponent <Electronic>();
            if (et != null)
            {
                et.MoveElec(gameObject, eyeSP, sp);
            }
        }
        if (other.CompareTag("Danger"))
        {
            DiePlayer();
        }

        if (other.CompareTag("Finish"))
        {
            if (stage <= 2)
            {
                //암전 코드
                SceneManager.LoadScene("Stage" + (stage + 1));
            }

            if (stage >= 3)
            {
                StartCoroutine(EndingEnding());
            }
        }
    }
        public Electronic CreateElectronic(ElectronicModel electronicData)
        {
            var electronics = new Electronic()
            {
                Id          = Guid.Empty,
                Name        = electronicData.Name,
                Price       = electronicData.Price,
                Description = electronicData.Description
            };

            _electronicDbContext.Electronics.Add(electronics);
            _electronicDbContext.SaveChanges();
            return(electronics);
        }
Exemplo n.º 15
0
        public ActionResult Editor(int id)
        {
            ViewBag.ElectronicId = id;
            Electronic electronic = db.Electronics.FirstOrDefault(a => a.Id == id);

            List <CategoryModel> categoryModels = db.Categories.ToList().Select(c => new CategoryModel {
                Id = c.Id, Name = c.Name
            }).ToList();
            ElecCategViewModel elecCategViewModel = new ElecCategViewModel()
            {
                Electronic = electronic, Categories = categoryModels
            };

            return(View(elecCategViewModel));
        }
Exemplo n.º 16
0
        static void Main(string[] args)
        {
            Snack      doritos  = new Snack("Doritos", 1.25m);
            Snack      mtDew    = new Snack("Mt. Dew", 2.00m);
            Snack      goldfish = new Snack("Goldfish", .50m);
            Electronic iPhone   = new Electronic("iPhone", 900.99m);


            VendingMachine vm = new VendingMachine();

            vm.AddItem(doritos);
            vm.AddItem(mtDew);
            vm.AddItem(goldfish, 0);
            vm.AddItem(iPhone);

            System.Console.WriteLine();
        }
Exemplo n.º 17
0
        public ActionResult Editor(Electronic electronic, HttpPostedFileBase upload, int categoryId)
        {
            Electronic electronicOld = db.Electronics.FirstOrDefault(a => a.Id == electronic.Id);

            electronicOld.Name  = electronic.Name;
            electronicOld.Maker = electronic.Maker;
            if (upload != null)
            {
                string path = "/Pictures/" + upload.FileName;
                upload.SaveAs(Server.MapPath(path));
                electronicOld.ImagePath = path;
            }
            electronicOld.Price       = electronic.Price;
            electronicOld.ReleaseYear = electronic.ReleaseYear;
            electronicOld.Category    = db.Categories.First(a => a.Id == categoryId);
            db.SaveChanges();
            return(RedirectToAction("Edit"));
        }
Exemplo n.º 18
0
        public void AddItem(Electronic electronic, int quantity)
        {
            CartLine line = lineCollection
                            .Where(g => g.Electronic.Id == electronic.Id)
                            .FirstOrDefault();

            if (line == null)
            {
                lineCollection.Add(new CartLine
                {
                    Electronic = electronic,
                    Quantity   = quantity
                });
            }
            else
            {
                line.Quantity += quantity;
            }
        }
Exemplo n.º 19
0
        static void Main(string[] args)
        {
            Console.Clear();
            Machine    myMachine = new Machine("Felix's Nourishment Bot");
            Food       snickers  = new Food(1f, 10, "Snickers", "Chocolate Bar", "04/2022");
            Food       kitkat    = new Food(1f, 9, "KitKat", "Chocolate Bar", "04/2025");
            Drink      aqua      = new Drink(1.75f, 10, "Aquafina", "beverage", "02/3000");
            Drink      coke      = new Drink(1.25f, 10, "Coke can", "beverage", "02/2022");
            Electronic earbuds   = new Electronic("Earbuds", 20f, 5, "SONY", "Music Accesory");
            Electronic usb       = new Electronic("USB Flash Drive", 10f, 8, "EMTEC", "Storage Device");

            myMachine.Inventory.Add("A1", snickers);
            myMachine.Inventory.Add("A2", kitkat);
            myMachine.Inventory.Add("A3", aqua);
            myMachine.Inventory.Add("A4", coke);
            myMachine.Inventory.Add("B1", earbuds);
            myMachine.Inventory.Add("B2", usb);

            //Print Available Items
            Console.WriteLine("Available Items:");
            foreach (var pair in myMachine.Inventory)
            {
                System.Console.WriteLine($"{pair.Key}, {pair.Value.Brand}, {pair.Value.Price}, {pair.Value.Quantity}");
            }
            Console.WriteLine("What would you like to buy? Enter Item code");
            string selection = Console.ReadLine();


            //Take item location
            foreach (var pair in myMachine.Inventory)
            {
                if (selection == pair.Key)
                {
                    pair.Value.Quantity = pair.Value.Quantity - 1;
                    System.Console.WriteLine("Yum!" + $"{pair.Value.Brand}");
                }
            }
            foreach (var pair in myMachine.Inventory)
            {
                System.Console.WriteLine($"{pair.Key}, {pair.Value.Brand}, {pair.Value.Price}, {pair.Value.Quantity}");
            }
        }
Exemplo n.º 20
0
    void CheckForWires()
    {
        for (int x = -1; x <= 1; x++)
        {
            for (int y = -1; y <= 1; y++)
            {
                Vector3Int pos = new Vector3Int(x, y, 0);

                Vector3Int localPos = (Vector3Int.FloorToInt(transform.position) + pos) - GameManager.manager.tileManager.worldOrigin;

                if (pos.magnitude <= 1 && pos.magnitude > 0)
                {
                    SaveableObject electronicObj = GameManager.manager.tileManager.utilityObjects[localPos.x, localPos.y];
                    if (electronicObj != null)
                    {
                        if (electronicObj.GetComponent <Electronic>() != null)
                        {
                            Electronic electronic = (Electronic)electronicObj;
                            Debug.Log(electronic.GetType());

                            if (!input.Contains(electronic))
                            {
                                //If the object is a wire, it will check it's connections to update other wires and/or add this wire to the list
                                if (electronic.GetType() == typeof(Wire) && electronic.generator != null)
                                {
                                    Debug.DrawRay(transform.position, pos, Color.blue, 1);
                                    ((Wire)electronic).CheckConnections();
                                    continue;
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 21
0
        public ActionResult Info(int id)
        {
            Electronic electronic = db.Electronics.Include(a => a.Category).First(a => a.Id == id);

            return(View(electronic));
        }
Exemplo n.º 22
0
    void CheckObject(SaveableObject electronicObj, Vector3Int pos)
    {
        //If the object is a generator and we have none, use the object
        Generator gen = electronicObj.GetComponent <Generator>();

        if (gen != null)
        {
            if (!input.Contains(gen))
            {
                input.Add(gen);
            }
            SetGenerator(gen);

            Debug.DrawRay(transform.position, pos, Color.green, 1);
        }
        else
        {
            Electronic electronic = (Electronic)electronicObj;

            //If the object is a wire, it will check it's connections to update other wires and/or add this wire to the list
            if (electronic.GetComponent <Wire>() != null && electronic.generator != null && electronic.generator != generator)
            //|| electronic.GetComponent<Wire>() != null && electronic.generator != null && electronic.generatorDistance <= generatorDistance)
            {
                ((Wire)electronic).CheckConnections();

                Debug.DrawRay(transform.position, pos, Color.blue, 1);
                return;
            }

            if (generator == null || input.Contains(electronic))
            {
                return;
            }

            //if the object has no generator and isn't already connected to our generator,
            if (electronic.generator == null || electronic.generator != generator)
            {
                electronic.input.Add(this);

                //Set the objects breaker to ours
                if (breaker != null)
                {
                    electronic.SetBreaker(breaker);
                }

                //Set the objects distance
                electronic.generatorDistance = generatorDistance + 1;
                electronic.SetGenerator(generator);

                //Make sure the objects current is consistant
                if (on)
                {
                    electronic.Enable();
                }
                else
                {
                    electronic.Disable();
                }

                if (!output.Contains(electronic))
                {
                    output.Add(electronic);
                }

                Debug.DrawRay(transform.position, pos, Color.green, 1);
            }

            //This is to reconnect chains
            if (electronic.GetComponent <Wire>() != null)
            {
                ((Wire)electronic).CheckConnections();
            }
        }
    }
Exemplo n.º 23
0
 public void RemoveLine(Electronic electronic)
 {
     lineCollection.RemoveAll(l => l.Electronic.Id == electronic.Id);
 }
Exemplo n.º 24
0
        public static async Task <Electronic> AddElectronicAsync(ApplicationDbContext _context, Electronic electronic)
        {
            _context.Electronics.Add(electronic);
            await _context.SaveChangesAsync();

            return(electronic);
        }
Exemplo n.º 25
0
        public async Task <IActionResult> Delete(int id)
        {
            Electronic elect = await ElectronicsDb.GetElectronicAsync(_context, id);

            return(View(elect));
        }
Exemplo n.º 26
0
 private void Awake()
 {
     parent = transform.parent.GetComponent <Electronic>();
 }