public JsonResult Create_Holiday(HRP_HOLIDAY holidyinfo) { string message = ""; try { if (ModelState.IsValid) { using (ProductionPlannerEntities dc = new ProductionPlannerEntities()) { if (holidyinfo != null) { dc.HRP_HOLIDAY.Add(holidyinfo); dc.SaveChanges(); } else { message = "failed"; } } } else { message = "failed"; } } catch (Exception ex) { message = "failed" + ex.ToString(); } return(new JsonResult { Data = message, JsonRequestBehavior = JsonRequestBehavior.AllowGet }); }