public ActionResult Create(Job_level_class model, string command) { try { if (ModelState.IsValid) { Job_level_class record = new Job_level_class(); record.Name = model.Name; record.Description = model.Description; record.Code = model.Code; record.max_annual_increase_percentage = model.max_annual_increase_percentage; record.max_basic_salary = model.max_basic_salary; record.max_incentive_amount = model.max_incentive_amount; record.max_incentive_percentage = model.max_incentive_percentage; record.max_monthly_allowance = model.max_monthly_allowance; record.mid_basic_salary = model.mid_basic_salary; record.min_basic_salary = model.min_basic_salary; record.min_working_years = model.min_working_years; record.representation_allowance_value = model.representation_allowance_value; record.dedicated_allowence = model.dedicated_allowence; var Job_level_class = dbcontext.Job_level_class.Add(record); dbcontext.SaveChanges(); ////// //var special = new Special_Allwonce_History(); //special.selectedID = Job_level_class.ID; //special.Job_level_class = Job_level_class; //special.type_allowance = type_allowance.job_level_class; //var spe = dbcontext.Special_Allwonce_History.Add(special); //dbcontext.SaveChanges(); ///// //=================================check for alert================================== var get_result_check = HR.Controllers.check.check_alert("job level class", 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(); } //=================================================================================== if (command == "Submit") { return(RedirectToAction("allowance", new { id = Job_level_class.ID, type = type_allowance.job_level_class })); } ; return(RedirectToAction("Index")); } else { return(View(model)); } } catch (DbUpdateException) { TempData["Message"] = HR.Resource.Basic.thiscodeIsalreadyexists; return(View(model)); } catch (Exception e) { return(View(model)); } }