//Delete JobFlow in Database public void Delete(int id) { using (TimeTrackerEntities db = new TimeTrackerEntities()) { try { T_JobFlow t_jobflow = new T_JobFlow(); t_jobflow = db.T_JobFlow.FirstOrDefault(f => f.Id == id); db.T_JobFlow.Remove(t_jobflow); db.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; } } }
//Parsing done before updating or inserting jobflow in database private void ParseJobFlow(T_JobFlow t_jobflow, JobFlow jobflow) { t_jobflow.Description = jobflow.Description; t_jobflow.Position = jobflow.Position; t_jobflow.Acronym = jobflow.Acronym; }
//Insert new JobFlow in Database public void Insert(JobFlow jobflow) { T_JobFlow t_jobflow = new T_JobFlow(); ParseJobFlow(t_jobflow,jobflow); using (TimeTrackerEntities db = new TimeTrackerEntities()) { try { db.T_JobFlow.Add(t_jobflow); db.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; } } }