public ActionResult Edit(ShiftVMs model, string command, FormCollection form)
        {
            try
            {
                ViewBag.shift       = dbcontext.Shift_setup.ToList().Select(m => new { Code = m.Code + "------[" + m.Name + ']', ID = m.ID });
                ViewBag.salary_code = dbcontext.salary_code.ToList().Select(m => new { Code = m.SalaryCodeID + "------[" + m.SalaryCodeDesc + ']', ID = m.ID });

                var original_model = dbcontext.Shiftdaystatus.FirstOrDefault(m => m.ID == model.Shiftdaystatus.ID);
                original_model.Description     = model.Shiftdaystatus.Description;
                original_model.Name            = model.Shiftdaystatus.Name;
                original_model.Alias           = model.Shiftdaystatus.Alias;
                original_model.Shift_setupID   = model.Shiftdaystatus.Shift_setupID;
                original_model.Color           = form["color"].Split(',')[0];
                original_model.Disable_Editing = model.Shiftdaystatus.Disable_Editing;
                dbcontext.SaveChanges();
                ///////////delete//////////
                var update_details = dbcontext.ShiftdaystatusDetials.Where(m => m.ShiftdaystatusId == original_model.ID.ToString()).ToList();
                dbcontext.ShiftdaystatusDetials.RemoveRange(update_details);
                dbcontext.SaveChanges();
                var codeid       = form["codeid"].Split(',');
                var SalaryDes    = form["SalaryDes"].Split(',');
                var DefaultValue = form["DefaultValue"].Split(',');
                ///////////////////add///////

                for (var i = 0; i < codeid.Length; i++)
                {
                    if (codeid[i] != "")
                    {
                        var new_details = new ShiftdaystatusDetials {
                            ShiftdaystatusId = original_model.ID.ToString(), Created_By = User.Identity.Name, Created_Date = DateTime.Now.Date, PayrollItemCode = codeid[i], DefaultValue = int.Parse(DefaultValue[i]), PayrollItemDescription = SalaryDes[i]
                        };
                        dbcontext.ShiftdaystatusDetials.Add(new_details);
                        dbcontext.SaveChanges();
                    }
                }

                if (command == "submit2")
                {
                    return(RedirectToAction("Link", new { id = original_model.ID }));
                }
                return(RedirectToAction("index"));
            }
            catch (Exception)
            {
                return(View(model));
            }
        }
        public ActionResult Create(Shiftdaystatus model, string command, FormCollection form)
        {
            try
            {
                ViewBag.shift       = dbcontext.Shift_setup.ToList().Select(m => new { Code = m.Code + "------[" + m.Name + ']', ID = m.ID });
                ViewBag.salary_code = dbcontext.salary_code.ToList().Select(m => new { Code = m.SalaryCodeID + "------[" + m.SalaryCodeDesc + ']', ID = m.ID });

                model.Color = form["color"].Split(',')[0];
                var codeid       = form["codeid"].Split(',');
                var SalaryDes    = form["SalaryDes"].Split(',');
                var DefaultValue = form["DefaultValue"].Split(',');
                var mo           = dbcontext.Shiftdaystatus.Add(model);
                dbcontext.SaveChanges();
                for (var i = 0; i < codeid.Length; i++)
                {
                    if (codeid[i] != "")
                    {
                        var new_details = new ShiftdaystatusDetials {
                            ShiftdaystatusId = mo.ID.ToString(), Created_By = User.Identity.Name, Created_Date = DateTime.Now.Date, PayrollItemCode = codeid[i], DefaultValue = int.Parse(DefaultValue[i]), PayrollItemDescription = SalaryDes[i]
                        };
                        dbcontext.ShiftdaystatusDetials.Add(new_details);
                        dbcontext.SaveChanges();
                    }
                }

                if (command == "submit2")
                {
                    return(RedirectToAction("Link", new { id = mo.ID }));
                }
                return(RedirectToAction("index"));
            }
            catch (Exception)
            {
                return(View(model));
            }
        }