/// <summary> /// 保存数据 /// </summary> /// <param name="model"></param> /// <returns></returns> public JsonResult SaveData(BreedVarietyModel model) { var result = new ResultJson(); try { var msg = new MessageModel(); if (model.VarietyId == 0) { msg = _breedVarietyService.InsertVarietyModel(model); } else { msg = _breedVarietyService.UpdateVarietyModel(model); } if (msg.Status == MessageStatus.Success) { result.IsSuccess = true; } } catch (Exception) { } return(Json(result)); }
public void Save() { var model = DtoToModel(Model); var result = new MessageModel(); if (Mode == EditMode.CREATE) { result = _breedVarietyService.InsertVarietyModel(model); } else if (Mode == EditMode.UPDATE) { result = _breedVarietyService.UpdateVarietyModel(model); } if (result.Status != MessageStatus.Success) { MessageBox.Show("保存失败"); } var win = GetView() as System.Windows.Window; if (win != null) { win.DialogResult = true; win.Close(); } }