public ActionResult Create(work_location model)
        {
            try
            {
                ViewBag.Shiftdaystatus = dbcontext.Shiftdaystatus.ToList().Select(m => new { Code = m.Code + "-[" + m.Name + ']', ID = m.ID });
                if (ModelState.IsValid)
                {
                    work_location record = new work_location();

                    record.Name                 = model.Name;
                    record.Description          = model.Description;
                    record.Code                 = model.Code;
                    record.Location_name        = model.Location_name;
                    record.Defaultdaystatuscode = model.Defaultdaystatuscode;
                    record.Absencedaystatus     = model.Absencedaystatus;
                    var location = dbcontext.work_location.Add(record);
                    dbcontext.SaveChanges();
                    //=================================check for alert==================================

                    var get_result_check = HR.Controllers.check.check_alert("work locations", HR.Models.user.Action.Create, HR.Models.user.type_field.form);
                    if (get_result_check != null)
                    {
                        var inbox = new Models.user.Alert_inbox {
                            send_from_user_id = User.Identity.Name, send_to_user_id = get_result_check.send_to_ID_user, title = get_result_check.Subject, Subject = get_result_check.Message
                        };
                        if (get_result_check.until != null)
                        {
                            if (get_result_check.until.Value.Year != 0001)
                            {
                                inbox.until = get_result_check.until;
                            }
                        }
                        ApplicationDbContext dbcontext = new ApplicationDbContext();
                        dbcontext.Alert_inbox.Add(inbox);
                        dbcontext.SaveChanges();
                    }
                    //===================================================================================
                    return(RedirectToAction("Index"));
                }
                else
                {
                    return(View(model));
                }
            }
            catch (DbUpdateException e)
            {
                TempData["Message"] = HR.Resource.Basic.thiscodeIsalreadyexists;
                return(View(model));
            }
            catch (Exception e)
            {
                return(View(model));
            }
        }
        public ActionResult Create()
        {
            ViewBag.Shiftdaystatus = dbcontext.Shiftdaystatus.ToList().Select(m => new { Code = m.Code + "-[" + m.Name + ']', ID = m.ID });
            var modell = new work_location();

            var stru  = dbcontext.StructureModels.FirstOrDefault(m => m.All_Models == ChModels.Organization).Structure_Code;
            var model = dbcontext.work_location.ToList();

            if (model.Count() == 0)
            {
                modell.Code = stru + "1";
            }
            else
            {
                modell.Code = stru + (model.LastOrDefault().ID + 1).ToString();
            }
            /////
            return(View(modell));
        }