Exemplo n.º 1
0
 public bool DeleteRecordById(int?id)
 {
     DemoVS4.Core.DAL.Product l = ctx.Products.Where(x => x.ProductID == id).FirstOrDefault();
     if (l != null)
     {
         ctx.Products.DeleteOnSubmit(l);
         ctx.SubmitChanges();
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        public JsonResult CheckDuplication(string ProductName)
        {
            DemoVS4.Core.DAL.Product items = ctx.Products.Where(x => x.ProductName == ProductName).FirstOrDefault();
            if (items != null)
            {
                return(Json(new { value = "true" }));
            }
            else
            {
                return(Json(new { value = "false" }));
            }


            /*JavaScriptSerializer jSerializer = new JavaScriptSerializer();
             * var publicationTable = ctx.Products.OrderBy(x=>x.ProductName);
             * //return Json(publicationTable, JsonRequestBehavior.AllowGet);  //this statement allow to see records directly on browser , you need also to set get in place of post in javascript(.aspx page)
             * return Json(publicationTable);  // this statement wont allow to see records directly on browser*/
        }