예제 #1
0
        public void CRUD()
        {
            //using (TransactionScope scope = new TransactionScope())
            //{
                GSTSvc svc = new GSTSvc();

                //Create
                GST entity = new GST()
                {
                   Code="07",
                    Rate=7
                };
                object result = svc.Save(entity);
                int id = ((GST)result).Id;

                //Get
                GST newEntity = svc.GetById(id);
                Assert.AreEqual(newEntity.Code, "07");

                //Update
                newEntity.Rate = 5;
                svc.Update(newEntity);
                Assert.AreEqual(newEntity.Rate, 5);

                //Delete
                svc.Delete(id);
                Assert.AreEqual(svc.GetById(id), null);
            //}
        }
예제 #2
0
 public ActionResult Create(GST GST)
 {
     if (ModelState.IsValid)
     {
         try
         {
             
             // TODO: Add insert logic here
             this.UpdateModel(GST);
             svc.Save(GST);
             return RedirectToAction("Index");
             
         }
         catch
         {
             return View(GST);
         }
     }
     return View(GST);
 }