public ChangeTypeDTO ToDTO(ChangeTypeEntity entity) { ChangeTypeDTO dto = new ChangeTypeDTO(); dto.ID = entity.ID; dto.TypeName = entity.TypeName; dto.TypeNameEn = entity.TypeNameEn; return(dto); }
public void SubmitForm(ChangeTypeEntity changeTypeEntity, string keyValue) { if (!string.IsNullOrEmpty(keyValue)) { changeTypeEntity.Modify(keyValue); service.Update(changeTypeEntity); } else { changeTypeEntity.Create(); service.Insert(changeTypeEntity); } }
public ActionResult SubmitForm(FormCollection collection, string keyValue) { ArrayList ChangeTypeArray = new ArrayList(); ChangeTypeEntity Entity = new ChangeTypeEntity(); Entity.FNumber = collection.GetValue("FNumber").AttemptedValue; Entity.FFullName = collection.GetValue("FFullName").AttemptedValue; Entity.FSortCode = Ext.ToInt(collection.GetValue("FSortCode").AttemptedValue); Entity.FEnabledMark = Ext.ToBool(collection.GetValue("FEnabledMark").AttemptedValue); Entity.FDescription = collection.GetValue("FDescription").AttemptedValue; foreach (string key in collection.AllKeys) { if (key.Contains("ChangeType") && collection.GetValue(key).AttemptedValue == "true") { ChangeTypeArray.Add(key.Replace("ChangeType", "")); } } Entity.FContent = string.Join(",", (string[])ChangeTypeArray.ToArray(typeof(string))); changeType.SubmitForm(Entity, keyValue); return(Success("操作成功。")); }