public ActionResult AddInputOutPut(int?SPID)
        {
            var model = new ProductionLineBalancing.Models.InputOutputInfo.InputOutputInfoModel();

            model.ScheduleProductionLineID = SPID;
            return(View(model));
        }
 public ActionResult Delete(ProductionLineBalancing.Models.InputOutputInfo.InputOutputInfoModel collection)
 {
     try
     {
         // TODO: Add delete logic here
         InputOutput_rep.Delete(collection.InputOutputID);
         InputOutput_rep.DeleteAllDetail(collection.InputOutputID);
         InputOutput_rep.DeleteAllDetail2(collection.InputOutputID);
         return(Content("ok"));
     }
     catch
     {
         return(View());
     }
 }
        public ActionResult Create(ProductionLineBalancing.Models.InputOutputInfo.InputOutputInfoModel collection, int SchID)
        {
            try
            {
                int parentID = 0;

                if (context.PP_InputOutputInfos.Where(q => q.ScheduleProductionLineID == SchID).FirstOrDefault() != null)
                {
                    collection.ScheduleProductionLineID = SchID;
                    collection.FaultID = collection.WasteFaultID;
                    InputOutput_rep.Edit(collection);
                    parentID = InputOutput_rep.Save();
                }
                else
                {
                    // TODO: Add insert logic here
                    if (collection.InputOutputID == 0)
                    {
                        collection.ScheduleProductionLineID = SchID;
                        collection.FaultID = collection.WasteFaultID;
                        InputOutput_rep.Add(collection);
                        parentID = InputOutput_rep.Save();
                    }
                    else
                    {
                        //var c_type = InputOutput_rep.GetByID(collection.GroupID);
                        //c_type.GroupName = collection.GroupName;
                        collection.ScheduleProductionLineID = SchID;
                        collection.FaultID = collection.WasteFaultID;
                        InputOutput_rep.Edit(collection);
                        parentID = InputOutput_rep.Save();
                    }
                }
                ResultType result = new ResultType();
                result.Status     = 0;
                result.ReturnType = 1;
                result.Parameters = new List <Tuple <string, string> >();
                result.Parameters.Add(new Tuple <string, string>("parentID", parentID.ToString()));
                return(Json(result, JsonRequestBehavior.AllowGet));
            }
            catch
            {
                return(View());
            }
        }