public int AddHireTypes(IEnumerable <hireType> items) { using (IOPContext db = new IOPContext()) { HireTypeConverter converter = new HireTypeConverter(db); IEnumerable <HireType> list = items.Select(p => converter.FromDto(p)); db.HireTypes.AddRange(list); return(db.SaveChanges()); } }
public int UpdateHireTypes(IEnumerable <hireType> items) { using (IOPContext db = new IOPContext()) { HireTypeConverter converter = new HireTypeConverter(db); foreach (var item in items) { var model = converter.FromDto(item); db.Entry(model).State = System.Data.Entity.EntityState.Modified; } return(db.SaveChanges()); } }