Exemplo n.º 1
0
        public void InsertTest()
        {
            Rating rating = new Rating();

            rating.Description = "Bananas";
            Assert.IsTrue(RatingManager.Insert(rating) > 0);
        }
Exemplo n.º 2
0
        public void InsertTest()
        {
            Rating rating = new Rating {
                Description = "new description"
            };

            Assert.AreNotEqual(0, RatingManager.Insert(rating));
        }
Exemplo n.º 3
0
        public void InsertTest()
        {
            Rating rating = new Rating();

            rating.Description = "X";


            bool result = RatingManager.Insert(rating);

            Assert.IsTrue(result);
        }
Exemplo n.º 4
0
 public ActionResult Create(Rating rating)
 {
     try
     {
         // TODO: Add insert logic here
         RatingManager.Insert(rating);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Exemplo n.º 5
0
 public ActionResult Create(Rating rating)
 {
     try
     {
         // TODO: Add insert logic here
         RatingManager.Insert(rating);
         return(RedirectToAction("Index"));
     }
     catch (Exception ex)
     {
         ViewBag.Message = ex.Message;
         return(View(rating));
     }
 }
Exemplo n.º 6
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                item = new Rating();

                //Assign the property values
                item.Description = txtDescription.Text;

                //use the manager to add a row
                int results = RatingManager.Insert(item);
                Response.Write("Inserted " + results + " rows...");
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }
Exemplo n.º 7
0
        protected void btnInsert_Click(object sender, EventArgs e)
        {
            try
            {
                rating = new Rating();
                // Get the typed description from the screen
                rating.Description = txtDescription.Text;

                // Add to the database
                RatingManager.Insert(rating);

                // Add to the list
                ratings.Add(rating);

                Rebind();
            }
            catch (Exception ex)
            {
                Response.Write("Error: " + ex.Message);
            }
        }
 // POST: api/Rating
 public void Post([FromBody] Rating rating)
 {
     RatingManager.Insert(rating);
 }