Example #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("CONTOH-CONTOH GADGET BESERTA FUNGSI");
            Console.WriteLine("-----------------------------------");
            Console.WriteLine();

            //Abstract Class (Handphone dan Laptop)
            Gadget gadget;

            gadget = new Handphone();
            gadget.Fungsi();

            Console.WriteLine();
            gadget = new Laptop();
            gadget.Fungsi();


            //Interface (Camera)
            IGadget2 gadget2;

            Console.WriteLine();
            gadget2 = new Camera();
            gadget2.Fungsi();

            Console.ReadKey();
        }
Example #2
0
        public void setDb(Context.MasterPool dbitem)
        {
            dbitem.Id         = Id;
            dbitem.IsActive   = IsActive;
            dbitem.NamePool   = NamePool;
            dbitem.Capacity   = Capacity;
            dbitem.Address    = Address;
            dbitem.IdProvinsi = IdProvinsi;
            dbitem.IdKabKota  = IdKabKota;
            dbitem.IdKec      = IdKec;
            dbitem.IdKel      = IdKel;
            dbitem.Latitude   = Latitude;
            dbitem.Longitude  = Longitude;
            dbitem.Radius     = Radius;
            dbitem.KodeTelp   = KodeTelp;
            dbitem.Telp       = Telp != null?Telp.Replace('-', ' ').Replace('_', ' ') : Telp;

            dbitem.Pic       = Pic;
            dbitem.Handphone = Handphone != null?Handphone.Replace('-', ' ').Replace('_', ' ') : Handphone;

            dbitem.IpAddress    = IpAddress;
            dbitem.IdCreditCash = IdCreditCash;

            dbitem.ListZoneParkir.Clear();

            ZoneParkir[] result = JsonConvert.DeserializeObject <ZoneParkir[]>(strPool);

            foreach (ZoneParkir item in result)
            {
                dbitem.ListZoneParkir.Add(new Context.ZoneParkir()
                {
                    IdZone = item.IdZone, Pit = item.Pit
                });
            }
        }
Example #3
0
        public ActionResult AddHandphone(long id)
        {
            //Controller untuk menampilkan page add/edit product
            //UI: Vindy
            //Code : Sindhu
            Handphone model;

            ViewBag.Brand = new SelectList(brandRepo.GetAllOrderbyName(), "Id", "Name");

            if (id == 0)
            {
                model = new Handphone();
            }
            else
            {
                model = handphoneRepo.GetById(id);
            }

            return(View(model));
        }
Example #4
0
 public ActionResult AddHandphone([Bind(Include = "Id, BrandId, Name, ProductDescription, SellPrice, BuyPrice")] Handphone handphone, HttpPostedFileBase upload)
 {
     //Controller untuk proses add/edit product
     //Code : Sindhu
     try
     {
         if (ModelState.IsValid)
         {
             if (upload != null)
             {
                 handphone.ImageUrl = SaveImage(upload);
             }
             handphoneRepo.Save(handphone);
             return(RedirectToAction("IndexHandphone"));
         }
         ViewBag.Brand = new SelectList(brandRepo.GetAllOrderbyName(), "Id", "Name");
         return(View(handphone));
     }
     catch
     {
         ViewBag.Brand = new SelectList(brandRepo.GetAllOrderbyName(), "Id", "Name");
         return(View(handphone));
     }
 }
 public IActionResult Post(Handphone handphone)
 {
     _context.Add(handphone);
     _context.SaveChanges();
     return(Ok(new { message = "success add data", data = handphone }));
 }