public JsonResult GetWine(long id)
        {
            Response.AppendHeader("Access-Control-Allow-Origin", "*");
            WineDa da = new WineDa();
            Wine wine = da.GetWine(id);

            return Json(wine, JsonRequestBehavior.AllowGet);
        }
        public JsonResult Insert(Wine wine)
        {
            Response.AppendHeader("Access-Control-Allow-Origin", "*");
            WineDa da = new WineDa();

            Wine result = da.Insert(wine);

            return Json(result);
        }
        public void DeleteWine()
        {
            WineDa da = new WineDa();

            long id = -332;
            int rowsAffected = da.Delete(id);

            Assert.IsTrue(rowsAffected == 0);
        }
        public void InsertWine()
        {
            Wine wine = new Wine();
            wine.name = "unit test wine";
            wine.grapes = "23";
            wine.country = "Bolivia";
            wine.region = "Sucre";
            wine.year = "2013";
            wine.description = "No description";
            wine.picture = "wine1.png";

            WineDa da = new WineDa();
            Wine result = da.Insert(wine);
            Assert.IsTrue(result != null);
        }
        public void UpdateWine()
        {
            Wine wine = new Wine();
            wine.id = 4;
            wine.name = "unit test wine";
            wine.grapes = "23";
            wine.country = "Bolivia";
            wine.region = "Bermejo";
            wine.year = "2013";
            wine.description = "No description";
            wine.picture = "wine2.png";

            WineDa da = new WineDa();
            int rowsAffected = da.Update(wine);
            Assert.IsTrue(rowsAffected >= 0);
        }
        public JsonResult Delete(long wineId)
        {
            Response.AppendHeader("Access-Control-Allow-Origin", "*");
            WineDa da = new WineDa();
            int rows = da.Delete(wineId);

            int status;
            string message;
            if (rows >= 0) {
                status = 200;
                message = "Deleted";
            } else {
                status = 400;
                message = "error";
            }

            return Json(new { Status = status, Message = message });
        }
 public void GetWine()
 {
     WineDa da = new WineDa();
     Wine wine = da.GetWine(1);
     Assert.IsTrue(wine != null);
 }
 public void GetAllWines()
 {
     WineDa da = new WineDa();
     List<Wine> wines = da.GetWines();
     Assert.IsTrue(wines.Count > 0);
 }