public IHttpActionResult ModifyTrafficRestriction(ModifyTrafficRestrictionRequest model) { ResponseBaseCommon response = new ResponseBaseCommon() { IsSuccess = true, MessageCode = (int)ApiBaseErrorCode.API_SUCCESS, MessageContent = ApiBaseErrorCode.API_SUCCESS.ToString() }; if (string.IsNullOrWhiteSpace(model.ParkingCode) || string.IsNullOrWhiteSpace(model.Guid) || string.IsNullOrWhiteSpace(model.ProjectGuid)) { response.IsSuccess = false; response.MessageCode = (int)ApiBaseErrorCode.API_PARAM_ERROR; response.MessageContent = "必要参数缺失,请检查"; return(Ok(response)); } TrafficRestrictionModel content = _trafficRestrictionManager.GetTrafficRestriction(model.Guid); if (content != null) { if (content.ProjectGuid == model.ProjectGuid) { string[] drivewayguids = (model.DrivewayGuid ?? "").Split(','); string[] cartypeguids = (model.CarTypeGuid ?? "").Split(','); content.DrivewayGuid = drivewayguids.ToList(); content.CarTypeGuid = cartypeguids.ToList();; content.AssignDays = model.AssignDays; content.StartTime = model.StartTime; content.EndTime = model.EndTime; List <DrivewayModel> drivewayList = _parkLotManager.AllDriveway(model.ParkingCode); if (!_trafficRestrictionManager.SaveTrafficRestriction(content, drivewayList)) { response.IsSuccess = false; response.MessageCode = (int)ApiBaseErrorCode.API_FAIL; response.MessageContent = "保存数据失败";// ApiBaseErrorCode.API_FAIL.ToString(); } } else { response.IsSuccess = false; response.MessageCode = (int)ApiBaseErrorCode.API_INTERFACENAME_ERROR; response.MessageContent = ApiBaseErrorCode.API_INTERFACENAME_ERROR.ToString(); } } else { response.IsSuccess = false; response.MessageCode = (int)ApiSystemErrorCode.API_DATA_NULL_ERROR; response.MessageContent = ApiSystemErrorCode.API_DATA_NULL_ERROR.ToString(); } return(Ok(response)); }
public IHttpActionResult RemoveTrafficRestriction(ModifyTrafficRestrictionRequest model) { ResponseBaseCommon response = new ResponseBaseCommon() { IsSuccess = true, MessageCode = (int)ApiBaseErrorCode.API_SUCCESS, MessageContent = ApiBaseErrorCode.API_SUCCESS.ToString() }; if (string.IsNullOrWhiteSpace(model.Guid) || string.IsNullOrWhiteSpace(model.ParkingCode) || string.IsNullOrWhiteSpace(model.ProjectGuid)) { response.IsSuccess = false; response.MessageCode = (int)ApiBaseErrorCode.API_PARAM_ERROR; response.MessageContent = "必要参数缺失,请检查"; return(Ok(response)); } TrafficRestrictionModel content = _trafficRestrictionManager.GetTrafficRestriction(model.Guid); if (content != null) { if (content.ProjectGuid == model.ProjectGuid && content.ParkCode == model.ParkingCode) { List <DrivewayModel> drivewayList = _parkLotManager.AllDriveway(content.ParkCode); if (!_trafficRestrictionManager.DeleteTrafficRestriction(content, drivewayList)) { response.IsSuccess = false; response.MessageCode = (int)ApiBaseErrorCode.API_FAIL; response.MessageContent = _trafficRestrictionManager.LastErrorDescribe; } } else { response.IsSuccess = false; response.MessageCode = (int)ApiBaseErrorCode.API_INTERFACENAME_ERROR; response.MessageContent = ApiBaseErrorCode.API_INTERFACENAME_ERROR.ToString(); } } else { response.IsSuccess = false; response.MessageCode = (int)ApiSystemErrorCode.API_DATA_NULL_ERROR; response.MessageContent = "未找到此限行规则";// ApiSystemErrorCode.API_DATA_NULL_ERROR.ToString(); } return(Ok(response)); }