private static ItemWarehouse getEntityByModel(ItemWarehouseModel model, int count)
        {
            if (model == null)
                return null;

            ItemWarehouse entity = new ItemWarehouse();

            if (count == 0)
            {
                entity.CreateBy = AuthenticationHelper.UserId;
                entity.CreateDate = DateTime.Now;
            }
            else
            {
                entity.CreateBy = model.CreateBy;
                entity.CreateDate = model.CreateDate;
            }

            entity.EndDate = model.EndDate;
            entity.Id = model.Id;
            entity.ItemId = model.ItemId;
            entity.SOBId = model.SOBId;
            entity.StartDate = model.StartDate;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            entity.WarehouseId = model.WarehouseId;
            return entity;
        }
 public long Update(ItemWarehouse entity)
 {
     var originalEntity = this.Context.ItemWarehouses.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id;
 }
 public ItemWarehouseModel(ItemWarehouse entity)
 {
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.EndDate = entity.EndDate;
     this.Id = entity.Id;
     this.ItemId = entity.ItemId;
     this.SOBId = entity.SOBId;
     this.StartDate = entity.StartDate;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
     this.WarehouseId = entity.WarehouseId;
 }
 public long Update(ItemWarehouse entity)
 {
     return this.repository.Update(entity);
 }
        //public ItemWarehouse GetSingle(long id)
        //{
        //    return this.repository.GetSingle(id);
        //}

        public long Insert(ItemWarehouse entity)
        {
            return this.repository.Insert(entity);
        }
 public long Insert(ItemWarehouse entity)
 {
     this.Context.ItemWarehouses.Add(entity);
     this.Commit();
     return entity.Id;
 }