public List <CareersClass> GetAllCareers(int id) { int ShowRecords = 20; int skip = id * ShowRecords; var DesiMasala = ""; var AllRecords = obj.Careers.Where(x => x.Status != 0); var Records = AllRecords.Count(); int max = (skip + ShowRecords); if (max > Records) { max = Records; } DesiMasala = (skip + 1).ToString() + "-" + max.ToString() + "/" + Records.ToString(); List <CareersClass> li = new List <CareersClass>(); var AllCareers = AllRecords.Skip(skip).Take(ShowRecords).Where(x => x.Status != 0).ToList(); var count = AllCareers.Count(); foreach (var details in AllCareers) { CareersClass temp = new CareersClass(); temp.Id = details.Id; temp.PositionTitle = details.PositionTitle; temp.Responsibilities = details.Responsibilities; temp.Requirments = details.Requirments; if (max >= Records) { temp.Next = id; } else { temp.Next = id + 1; } if (id == 0) { temp.Prev = id; } else { temp.Prev = id - 1; } temp.Count = count; temp.NumberOfShowing = DesiMasala; li.Add(temp); } return(li); }
public int UpdateCareer(CareersClass CC) { int check = 0; try { Career careers = obj.Careers.First(x => x.Id.Equals(CC.Id)); careers.PositionTitle = CC.PositionTitle; careers.Responsibilities = CC.Responsibilities; careers.Requirments = CC.Requirments; obj.SubmitChanges(); check = careers.Id; } catch (Exception e) { check = 0; } return(check); }
public int PostCareer(CareersClass CC) { int check = 0; try { Career careers = new Career(); careers.PositionTitle = CC.PositionTitle; careers.Responsibilities = CC.Responsibilities; careers.Requirments = CC.Requirments; careers.Status = 1; obj.Careers.InsertOnSubmit(careers); obj.SubmitChanges(); check = careers.Id; } catch (Exception e) { check = 0; } return(check); }
public List <CareersClass> GetAllCareersById(int id) { List <CareersClass> li = new List <CareersClass>(); var AllCareers = obj.Careers.Where(x => x.Status != 0 && x.Id.Equals(id)).ToList(); var count = AllCareers.Count(); foreach (var details in AllCareers) { CareersClass temp = new CareersClass(); temp.Id = details.Id; temp.PositionTitle = details.PositionTitle; temp.Responsibilities = details.Responsibilities; temp.Requirments = details.Requirments; temp.Count = count; li.Add(temp); } return(li); }