public int AddOrUpdateRestaurantDTO(AddOrUpdateRestaurantDTO restaurant, string operatorName) { if (restaurant == null) { throw new ArgumentNullException("餐厅必须设定"); } if (string.IsNullOrWhiteSpace(operatorName)) { throw new ArgumentNullException("操作人必须设定"); } CRestaurantPO restaurantPO = null; if (restaurant.Id > 0) { restaurantPO = CRestaurantManager.Instance.GetById(restaurant.Id); if (restaurantPO == null) { throw new BusinessException("此餐厅不存在"); } } else { restaurantPO = new CRestaurantPO(); } restaurantPO.Address = restaurant.Address; restaurantPO.AllowedDistance = restaurant.AllowedDistance; restaurantPO.CityId = restaurant.CityId; restaurantPO.ContactNumber = restaurant.ContactNumber; restaurantPO.ImgUrl = restaurant.ImgUrl; restaurantPO.Latitude = restaurant.Latitude; restaurantPO.Longitude = restaurant.Longitude; restaurantPO.Name = restaurant.Name; restaurantPO.IsDelete = restaurant.IsDelete; restaurantPO.Remark = restaurant.Remark; restaurantPO.ServerFee = restaurant.ServerFee; restaurantPO.State = restaurant.State; restaurantPO.Alphabet = restaurant.Alphabet; if (restaurantPO.Id > 0) { return(Update(restaurantPO, operatorName)); } else { return(Add(restaurantPO, operatorName)); } }
public ReturnValue <int> AddOrUpdateRestaurantDTO(AddOrUpdateRestaurantDTO restaurant, string operatorName) { return(ReturnValue <int> .Get200OK(CRestaurantManager.Instance.AddOrUpdateRestaurantDTO(restaurant, operatorName))); }