public async Task Insert(ProbationView entity) { try { //Insert New Probation var vList = new Probation { Prob_Id = entity.Prob_Id, Company_Id = entity.Company_Id, Prob_Code = entity.Prob_Code, Prob_Name = entity.Prob_Name, Prob_Description = entity.Prob_Description, Prob_DurationUnit = entity.Prob_DurationUnit, Prob_Duration = entity.Prob_Duration, Notes = entity.Notes, isActive = entity.isActive, AddedBy = entity.AddedBy, AddedOn = DateTime.Now }; adbContext.probation.Add(vList); await Task.FromResult(adbContext.SaveChanges()); } catch (Exception ex) { throw ex; } }
private static Employee ProceedRecord(DataRow row) { string firstname = row[0].ToString(); string secondname = row[1].ToString(); string lastname = row[2].ToString(); DateTime.TryParse(row[3].ToString(), out DateTime birthDate); DateTime.TryParse(row[4].ToString(), out DateTime emplDate); string skillName = row[5].ToString().Trim().ToLower(); int.TryParse(row[6].ToString().Trim(), out int probPeriod); string depName = row[7].ToString().Trim().ToLower(); //--------------------------------------------------------- SkillLevel skillLevel = DataManager .SkillLevels .FirstOrDefault(s => s.Description.ToLower().Contains(skillName)); Probation probation = DataManager .ProbationPeriods .FirstOrDefault(s => s.DurationInMonth == probPeriod); Department department = DataManager .Departments .FirstOrDefault(s => s.Title.ToLower().Contains(depName)); var empl = new Employee() { Firstname = firstname, Secondname = secondname, Lastname = lastname, Birthday = birthDate, EmploymentDate = emplDate, Skill = skillLevel, ProbationPeriod = probation, CurrentDepartment = department }; return(empl); }