public string Update(Warehouse entity)
 {
     if (entity.IsValid())
         return this.repository.Update(entity);
     else
         return "Entity is not in a valid state";
 }
Ejemplo n.º 2
0
        private static Warehouse getEntityByModel(WarehouseModel model)
        {
            if (model == null) return null;

            Warehouse entity = new Warehouse();

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

            entity.WarehouseName = model.WarehouseName;
            entity.Id = model.Id;
            entity.SOBId = model.SOBId;
            entity.Status = model.Status;
            entity.UpdateBy = AuthenticationHelper.UserId;
            entity.UpdateDate = DateTime.Now;
            return entity;
        }
 public string Update(Warehouse entity)
 {
     var originalEntity = this.Context.Warehouses.Find(entity.Id);
     this.Context.Entry(originalEntity).CurrentValues.SetValues(entity);
     this.Context.Entry(originalEntity).State = EntityState.Modified;
     this.Commit();
     return entity.Id.ToString();
 }
Ejemplo n.º 4
0
 public WarehouseModel(Warehouse entity)
 {
     this.Id = entity.Id;
     this.SOBId = entity.SOBId;
     this.Status = entity.Status;
     this.WarehouseName = entity.WarehouseName;
     this.CompanyId = entity.CompanyId;
     this.CreateBy = entity.CreateBy;
     this.CreateDate = entity.CreateDate;
     this.UpdateBy = entity.UpdateBy;
     this.UpdateDate = entity.UpdateDate;
 }
 public string Insert(Warehouse entity)
 {
     this.Context.Warehouses.Add(entity);
     this.Commit();
     return entity.Id.ToString();
 }