public void Save() { if (GroupInfoID != 0) { new GroupInfoDAL().Update(ToModel()); } else { var DAL = new GroupInfoDAL(); DAL.Add(ToModel()); if (ObjectHascode != 0) { var model = DAL.GetByObjectHashCode(ObjectHascode); if (model == null) { return; } GroupInfoID = model.GroupInfoID; } } }