public string UpdateCustomer(Customer customer) { CustomerAccessor accessor = new CustomerAccessor(); try { return(accessor.UpdateCustomer(customer) == -1 ? "项目名称在数据中已存在!" : "保存成功!"); } catch (Exception ex) { LogError(ex); return("保存失败!" + ex.Message); } }
/// <summary> /// Updates the customer. /// </summary> /// <param name="customer">The customer.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> public bool UpdateCustomer(Customer customer) { try { if (CustomerAccessor.UpdateCustomer(customer) >= 1) { return(true); } else { return(false); } } catch (Exception) { throw; } }
public bool EditCustomer(Customer customer) { bool edited = false; customer.Active = true; try { if (CustomerAccessor.UpdateCustomer(customer)) { edited = true; } } catch (Exception ex) { throw new ApplicationException("User could not be edited: " + ex.Message); } return(edited); }