Beispiel #1
0
        public IHttpActionResult stuffinsert(stuff stuffInsert)
        {
            DC.stuffs.Add(stuffInsert);
            DC.SaveChanges();

            return(Ok());
        }
Beispiel #2
0
        public void Enumeration_BothDuplicatesAndNoDuplicates_Success()
        {
            sl.Add(s0 = new stuff(0));
            sl.Add(s1 = new stuff(0));
            sl.Add(s2 = new stuff(1));
            sl.Add(s3 = new stuff(2));
            sl.Add(s4 = new stuff(3));
            int i = 0;

            foreach (stuff s in sl)
            {
                if (i == 0)
                    Assert.IsTrue(s.val == s0.val || s.val == s1.val);
                else if (i == 1)
                    Assert.IsTrue(s.val == s0.val || s.val == s1.val);
                else if (i == 2)
                    Assert.AreEqual(s, s2);
                else if (i == 3)
                    Assert.AreEqual(s, s3);
                else if (i == 4)
                    Assert.AreEqual(s, s4);

                i++;
            }

            Assert.AreEqual(5, i);
        }
        public ActionResult DeleteConfirmed(int id)
        {
            stuff stuff = db.stuffs.Find(id);

            db.stuffs.Remove(stuff);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,StuffParameter")] stuff stuff)
 {
     if (ModelState.IsValid)
     {
         db.Entry(stuff).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(stuff));
 }
        public ActionResult Create([Bind(Include = "Id,StuffParameter")] stuff stuff)
        {
            if (ModelState.IsValid)
            {
                db.stuffs.Add(stuff);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(stuff));
        }
Beispiel #6
0
    public void ListTJOSN()
    {
        stuff hello = new stuff();

        hello.aList.Add(20);
        hello.aList.Add(2);
        string why = JsonUtility.ToJson(hello);
        stuff  hea = JsonUtility.FromJson <stuff>(why);

        Assert.AreEqual(hello.aList.Count, hea.aList.Count);
        Assert.AreEqual(hello.aList[0], hea.aList[0]);
        Assert.AreEqual(hello.aList[1], hea.aList[1]);
    }
    MyDisposableClass() // Constructor
    {
        bool ok = false;

        try
        {
            myThing = new SomeDisposableThing();
            ...do
            {
                some other stuff
                    ok = true;
            }
        }
Beispiel #8
0
        public void Add_DuplicateSortValue_Success()
        {
            sl.Add(s2 = new stuff(2));
            sl.Add(s0 = new stuff(0));
            sl.Add(s1 = new stuff(1));
            sl.Add(s3 = new stuff(2));

            Assert.AreEqual(4, sl.Count);

            Assert.AreEqual(s0, sl[0].First());
            Assert.AreEqual(s1, sl[1].First());
            Assert.AreEqual(s2, sl[2].First());
            Assert.AreEqual(s3, sl[2].Last());
        }
        // GET: stuffs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            stuff stuff = db.stuffs.Find(id);

            if (stuff == null)
            {
                return(HttpNotFound());
            }
            return(View(stuff));
        }
Beispiel #10
0
    // Use this for initialization
    void Start()
    {
        m_Stuff          = GameObject.FindGameObjectWithTag("Stuff").GetComponent <stuff>();
        m_Time           = GameObject.FindGameObjectWithTag("Time").GetComponent <Text>();
        m_Height         = GameObject.FindGameObjectWithTag("Height").GetComponent <Text>();
        m_Height.enabled = false;
        m_LV             = GameObject.FindGameObjectWithTag("LV").GetComponent <Text>();

        m_Main        = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <Camera>();
        m_StuffCamera = GameObject.FindGameObjectWithTag("StuffCamera").GetComponent <Camera>();

        SetCameraIndex(true, false);

        m_Animation.enabled = false;
    }
        public ActionResult Create(stuff insertstuff)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("http://localhost:65460/api/Inventory");
            var insertrecord = hc.PostAsJsonAsync <stuff>("Inventory", insertstuff);

            insertrecord.Wait();
            var savedata = insertrecord.Result;

            if (savedata.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }
            return(View("Create"));
        }
Beispiel #12
0
        public void Add_WrongOrder_Success()
        {
            sl.Add(s2 = new stuff(2));
            sl.Add(s0 = new stuff(0));
            sl.Add(s1 = new stuff(1));
            sl.Add(s4 = new stuff(4));
            sl.Add(s3 = new stuff(3));

            Assert.AreEqual(5, sl.Count);

            Assert.AreEqual(s0, sl[0].First());
            Assert.AreEqual(s1, sl[1].First());
            Assert.AreEqual(s2, sl[2].First());
            Assert.AreEqual(s3, sl[3].First());
            Assert.AreEqual(s4, sl[4].First());
        }
Beispiel #13
0
        void listhanghoanek()
        {
            listHangHoa = new List <stuff>();
            var resuliit = DataProvider.Ins.DB.GUIHANGHOAs.Where(p => p.IDCHUYEN == StaticIDChuyen.StaIDchuyen).ToList();

            foreach (var item in resuliit)
            {
                //var result1 = (from c in DataProvider.Ins.DB.KHACHDIXEs where c.IDKHACH == item.idkhach select c.id).ToList();
                stuff a1 = new stuff();
                a1.hoten   = item.HOTEN;
                a1.diachi  = item.DIACHI;
                a1.sdt     = item.SDT;
                a1.tenhang = item.TENHANG;
                a1.giatien = item.GIATIEN;
                //if (a1.soghedamua == null) break;
                listHangHoa.Add(a1);
            }
        }
Beispiel #14
0
        public IHttpActionResult Put(stuff st)
        {
            var updatestuff = DC.stuffs.Where(x => x.itemid == st.itemid).FirstOrDefault <stuff>();

            if (updatestuff != null)
            {
                updatestuff.itemid       = st.itemid;
                updatestuff.name         = st.name;
                updatestuff.descriptions = st.descriptions;
                updatestuff.price        = st.price;
                DC.SaveChanges();
            }
            else
            {
                return(NotFound());
            }
            return(Ok());
        }
        public ActionResult Edit(stuff st)
        {
            HttpClient hc = new HttpClient();

            hc.BaseAddress = new Uri("http://localhost:65460/api/Inventory");
            var insertrecord = hc.PutAsJsonAsync <stuff>("Inventory", st);

            insertrecord.Wait();
            var savedata = insertrecord.Result;

            if (savedata.IsSuccessStatusCode)
            {
                return(RedirectToAction("Index"));
            }
            else
            {
                ViewBag.message = "not updated";
            }
            return(View(st));
        }
        public ActionResult Edit(int id)
        {
            stuff      stuffobj = null;
            HttpClient hc       = new HttpClient();

            hc.BaseAddress = new Uri("http://localhost:65460/api/Inventory");
            var consumeapi = hc.GetAsync("Inventory?id=" + id.ToString());

            consumeapi.Wait();
            var readdata = consumeapi.Result;

            if (readdata.IsSuccessStatusCode)
            {
                var displaydata = readdata.Content.ReadAsAsync <stuff>();
                displaydata.Wait();
                stuffobj = displaydata.Result;
            }

            return(View(stuffobj));
        }
Beispiel #17
0
        public void Remove_NoDuplicate_Success()
        {
            sl.Add(s2 = new stuff(2));
            sl.Add(s0 = new stuff(0));
            sl.Add(s1 = new stuff(1));
            sl.Add(s4 = new stuff(4));
            sl.Add(s3 = new stuff(3));

            sl.Remove(s3);

            Assert.AreEqual(4, sl.Count);

            Assert.AreEqual(s0, sl[0].First());
            Assert.AreEqual(s1, sl[1].First());
            Assert.AreEqual(s2, sl[2].First());
            Assert.AreEqual(s4, sl[3].First());
        }
Beispiel #18
0
 // SendMessage
 [DllImport(user32)] static public extern IntPtr SendMessage(IntPtr hWnd, stuff Msg, stuff wParam, IntPtr lParam);