public ActionResult SaveMaster(MasterAndTable model)
 {
     System.Diagnostics.Debug.WriteLine("SaveMaster1" + DateTime.Now);
     model.Save();
     System.Diagnostics.Debug.WriteLine("SaveMaster2" + DateTime.Now);
     return(Json(model));
 }
        public ActionResult MasterDetails(string idMastersAsString)
        {
            try
            {
                using (var dc = new MySQLEntities())
                {
                    //SelectList districts = new SelectList(dc.districts.ToList(), "iddistricts", "name");
                    //ViewBag.Districts = districts;

                    //SelectList worktypes = new SelectList(dc.worktypes.ToList(), "idWorkTypes", "name");
                    //ViewBag.Worktypes = worktypes;

                    var master = new masters();
                    if (idMastersAsString == "")
                    {
                        master.idMasters = Guid.NewGuid();
                    }
                    else
                    {
                        Guid idMasters = new Guid(idMastersAsString);
                        master = dc.masters.Find(idMasters);
                    }

                    var model = new MasterAndTable(master)
                    {
                        master = master,
                    };

                    ViewBag.districtsmaster = model.districtsmaster;

                    return(PartialView(model));
                };
            }
            catch (Exception ex)
            {
                return(HttpNotFound());
            }
        }
 public ActionResult RemoveDistrictMaster(MasterAndTable model, int index)
 {
     model.RemoveDistrictMaster(index);
     return(Json(model));
 }
 public ActionResult AddDistrictMaster(MasterAndTable model)
 {
     model.AddDistrictMaster();
     return(Json(model));
 }
 public ActionResult MasterDetails(MasterAndTable model)
 {
     System.Diagnostics.Debug.WriteLine("MasterDetails1" + DateTime.Now);
     Thread.Sleep(1000);
     return(RedirectToAction("../Home/Masters"));
 }
 public ActionResult RemoveWorktypeMaster(MasterAndTable model, int index)
 {
     model.RemoveWorktypeMaster(index);
     return(Json(model));
 }
 public ActionResult AddWorktypeMaster(MasterAndTable model)
 {
     model.AddWorktypeMaster();
     return(Json(model));
 }