public ActionResult Edit([Bind(Include = "SerialNo,IdNo,FullName,EnglishFullName,Email,Podobi,Salary,Category,Department,JoiningDate,AccountNo,MainSalaryGrade,IncrementNo,Sex,IsFreedomFighter,IsAddiitonalDuties,IsStudentAdviser,IsDean,IsChairman,IsProvost,IsProctor,IsAssistantProctor,HasOwnTransportationMethod,IsTeacher")] Employee employee) { if (ModelState.IsValid) { var grade = from a in db.Grades where a.GradeRange.Equals(employee.MainSalaryGrade) select a; Grade orDefault = grade.FirstOrDefault(); if (orDefault != null) { int grad = orDefault.GradeNo; int increment = Int32.Parse(LanguageConverter.BanglaToEnglish(employee.IncrementNo)); var mainsalaryString = from a in db.Taxes where a.Grade.Equals(grad) && a.Scale.Equals(increment) select a; var firstOrDefault = mainsalaryString.FirstOrDefault(); if (firstOrDefault != null) { employee.Salary = firstOrDefault.MainSalary; } } db.Entry(employee).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(employee)); }
public static string GetAllowanceFromDb(string searchString) { _db = new BUEMSDbContext(); string all = "০"; var results = from a in _db.Allowances where a.DutyName.Equals(searchString) select a; foreach (Allowance allowance in results) { all = allowance.AllowanceAmount; } return(LanguageConverter.BanglaToEnglish(all)); }