public bool Save(UnitList unitlist, out string strResult) { strResult = string.Empty; bool result = false; IQueryable <Unit> unit = UnitRepository.GetQueryable(); var u1 = UnitRepository.GetQueryable().FirstOrDefault(un => un.UnitCode == unitlist.UnitCode01); var u2 = UnitRepository.GetQueryable().FirstOrDefault(un => un.UnitCode == unitlist.UnitCode01); var u3 = UnitRepository.GetQueryable().FirstOrDefault(un => un.UnitCode == unitlist.UnitCode01); var u4 = UnitRepository.GetQueryable().FirstOrDefault(un => un.UnitCode == unitlist.UnitCode01); var ul = UnitListRepository.GetQueryable().FirstOrDefault(u => u.UnitListCode == unitlist.UnitListCode); ul.UnitListCode = unitlist.UnitListCode; ul.UniformCode = unitlist.UniformCode; ul.UnitListName = unitlist.UnitListCode; ul.UnitCode01 = unitlist.UnitCode01; ul.Quantity01 = Convert.ToInt32(unitlist.Quantity01); ul.UnitCode02 = unitlist.UnitCode02; ul.Quantity02 = Convert.ToInt32(unitlist.Quantity02); ul.UnitCode03 = unitlist.UnitCode03; ul.Quantity03 = Convert.ToInt32(unitlist.Quantity03); ul.UnitCode04 = unitlist.UnitCode04; ul.IsActive = unitlist.IsActive; ul.UpdateTime = DateTime.Now; UnitListRepository.SaveChanges(); return(true); }
public bool Delete(string unitlistCode) { var unitlist = UnitListRepository.GetQueryable() .FirstOrDefault(b => b.UnitListCode == unitlistCode); if (unitlistCode != null) { UnitListRepository.Delete(unitlist); UnitListRepository.SaveChanges(); } else { return(false); } return(true); }
public bool Save(UnitList unitlist) { var ul = UnitListRepository.GetQueryable().FirstOrDefault(u => u.UnitListCode == unitlist.UnitListCode); ul.UnitListCode = unitlist.UnitListCode; ul.UniformCode = unitlist.UniformCode; ul.UnitListName = unitlist.UnitListCode; ul.UnitCode01 = unitlist.UnitCode01; ul.Quantity01 = Convert.ToInt32(unitlist.Quantity01); ul.UnitCode02 = unitlist.UnitCode02; ul.Quantity02 = Convert.ToInt32(unitlist.Quantity02); ul.UnitCode03 = unitlist.UnitCode03; ul.Quantity03 = Convert.ToInt32(unitlist.Quantity03); ul.UnitCode04 = unitlist.UnitCode04; ul.IsActive = unitlist.IsActive; ul.UpdateTime = DateTime.Now; UnitListRepository.SaveChanges(); return(true); }
public new bool Add(UnitList unitlist) { var ul = new UnitList(); ul.UnitListCode = unitlist.UnitListCode; ul.UniformCode = unitlist.UniformCode; ul.UnitListName = unitlist.UnitListName; ul.UnitCode01 = unitlist.UnitCode01; ul.Quantity01 = Convert.ToInt32(unitlist.Quantity01); ul.UnitCode02 = unitlist.UnitCode02; ul.Quantity02 = Convert.ToInt32(unitlist.Quantity02); ul.UnitCode03 = unitlist.UnitCode03; ul.Quantity03 = Convert.ToInt32(unitlist.Quantity03); ul.UnitCode04 = unitlist.UnitCode04; ul.IsActive = unitlist.IsActive; ul.UpdateTime = DateTime.Now; UnitListRepository.Add(ul); UnitListRepository.SaveChanges(); return(true); }