示例#1
0
 public virtual void Editar(Smartphones entidad)
 {
     if (Validar(entidad))
     {
         context.Update(entidad);
         context.SaveChanges();
     }
 }
示例#2
0
 public virtual void Agregar(Smartphones entidad)
 {
     if (Validar(entidad))
     {
         context.Add(entidad);
         context.SaveChanges();
     }
 }
示例#3
0
        public SmartPhone GetItem(string uniqueId)
        {
            var result = Smartphones.Where(x => x.Id == Int32.Parse(uniqueId));

            if (result.Count() == 1)
            {
                foreach (SmartPhone s in result)
                {
                    Smartphone_Details = s;
                }
            }
            return(Smartphone_Details);
        }
示例#4
0
        public IActionResult Eliminar(Smartphones cel)
        {
            Repository repository = new Repository();
            var        smart      = repository.GetCelById(cel.Id);

            if (smart != null)
            {
                smart.Eliminado = 1;
                repository.Editar(smart);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(RedirectToAction("Index", "Home"));
            }
        }
示例#5
0
    public static void Main()
    {
        var numbers = Console.ReadLine().Split();
        var urls    = Console.ReadLine().Split();

        var smartphone = new Smartphones();

        foreach (var number in numbers)
        {
            Console.WriteLine(smartphone.Calling(number));
        }

        foreach (var url in urls)
        {
            Console.WriteLine(smartphone.Browsing(url));
        }
    }
示例#6
0
        public void AddToBasketTwoProducts()
        {
            HuaweiMainPage page            = new HuaweiMainPage(driver);
            Smartphones    smartPhonespage =
                page.OpenHomePage()
                .OpenSmartphones()
                .AddToBasketPhoneMate30Pro();
            Tablets tabletsPage =
                page.OpenTablets()
                .AddToBasketMatePad();
            int basketPage =
                page.OpenBasketPage()
                .GetPrice()
                .GetTotalPriceOfTwoProducts();

            Assert.AreEqual(basketPage, FirstTestExpectedResult);
        }
示例#7
0
        public async void GetData()
        {
            //for (int i = 0; i < 100; i++)
            //{
            //    Smartphones.Add(new SmartPhone(i, "http://www.evertek.com.tn/Produits/AndroidSeries/EverShinePlus/Photos/WebBrut/Noir/MiniSite/xImage1DeFaceAvecOmbreMiniSitebg1.png.pagespeed.ic.VHN7-i6CFy.png", "EVERTEK EVERSHINE II", "Référence  EVER-SHINE-II-GOLD", "Ecran:  5.5\" ips HD - Résolution: 1280 x 720 px - Processeur MediaTek MT6735 Quad - Core, Cortex - A53 1.3GHz - Mémoire RAM 1 Go - Stockage 16 Go Extensible Jusqu'à 32 Go Via Micro SD - Systéme d'exploitation: Android 5.1 Lollipop - 2x Appareils Photo 13 Mégapixels(Arrière), 5 Mégapixels(Frontale) - Wifi - 4G - Bluetooth - GPS - Double SIM - Garantie 1 an - Facilite sur 6 mois 73DT, 9 mois 51DT et 12 mois 40DT", "389,00 DT"));

            //}
            try
            {
                var Response = await REST_Services.GetSmartPhones();

                foreach (SmartPhone s in Response)
                {
                    Smartphones.Add(s);
                }
            }
            catch (Exception ex)
            {
                MessageDialog msg = new MessageDialog(ex.ToString());
                await msg.ShowAsync();
            }
        }
示例#8
0
        public virtual bool Validar(Smartphones entidad)
        {
            if (string.IsNullOrWhiteSpace(entidad.Nombre))
            {
                throw new Exception("Escriba el nombre.");
            }

            if (string.IsNullOrWhiteSpace(entidad.Descripcion))
            {
                throw new Exception("Escriba la descripción.");
            }

            if (entidad.IdMarca <= 0)
            {
                throw new Exception("Escriba la marca.");
            }

            if (entidad.Caracteristicas.Peso <= 0)
            {
                throw new Exception("Escriba el peso.");
            }

            if (entidad.Caracteristicas.Tamaño <= 0)
            {
                throw new Exception("Escriba el tamaño.");
            }

            if (entidad.Almacenamiento < 0)
            {
                throw new Exception("Escriba el almacenamiento.");
            }

            if (string.IsNullOrWhiteSpace(entidad.Pantalla))
            {
                throw new Exception("Escriba la resolusion.");
            }

            if (string.IsNullOrWhiteSpace(entidad.Procesador))
            {
                throw new Exception("Escriba el procesador.");
            }

            if (entidad.Ram < 0)
            {
                throw new Exception("Escriba la memoria RAM.");
            }

            if (entidad.Caracteristicas.Bateria < 0)
            {
                throw new Exception("Escriba la batería");
            }

            if (string.IsNullOrWhiteSpace(entidad.Caracteristicas.Camara))
            {
                throw new Exception("Escriba caracteristicas de la cámara.");
            }

            if (entidad.Caracteristicas.Precio < 0)
            {
                throw new Exception("Escriba el precio.");
            }

            if (string.IsNullOrWhiteSpace(entidad.Caracteristicas.So))
            {
                throw new Exception("Escriba el sistema operativo.");
            }

            if (string.IsNullOrWhiteSpace(entidad.Expansion))
            {
                throw new Exception("Escriba la disponibilidad de expancion.");
            }
            return(true);
        }
示例#9
0
 public virtual void Delete(Smartphones entidad)
 {
     context.Remove(entidad);
     context.SaveChanges();
 }
示例#10
0
 public string SmartphoneSelector()
 {
     smartphonesApple = (Smartphones)EditorGUILayout.EnumPopup("Device:", smartphonesApple);
     return(smartphonesApple.ToString());
 }